Thursday, June 19, 2014 [Tweets]

The Safyness of Static Typing

Marcel Weiher:

That the compiler is capable of catching (some) bugs using static type checks is undeniably true. However, what is also obviously true is that not all bugs are type errors (for example, most of the 25 top software errors don’t look like type errors to me, and neither goto fail; nor Heartbleed look like type errors either, and neither do the top errors in my different projects), so having the type-checker give our programs a clean bill of health does not make them bug free, it eliminates a certain type or class of bugs.


[Robert Smallshire] talks about this some more in the talk titled The Unreasonable Effectiveness of Dynamic Typing, which I heartily recommend. However, this isn’t the only source, for example there was a study with the following title: An experiment about static and dynamic type systems: doubts about the positive impact of static type systems on development time (pdf), which found the following to be true in experiments: not only were development times significantly shorter on average with dynamically typed languages, so were debug times.

1 Comment

While I prefer dynamically typed languages overall, I think the main advantage static typing brings is not safety or development time. Instead, it's the fact that the computer knows more about what you're doing than with a dynamically typed language.

This gives you access to things like the ability to automatically refactor code. If you have a long-running project (say, decade+), you will inevitably run into situations where you want to refactor large parts of your code. Static typing helps a lot.

Stay up-to-date by subscribing to the Comments RSS Feed for this post.

Leave a Comment