This post originated from an RSS feed registered with Scala Buzz
by Daniel Sobral.
Original Post: Bugs and dynamically vs statically typed languages
Feed Title: Algorithmically challenged
Feed URL: http://dcsobral.blogspot.com/feeds/posts/default
Feed Description: Random thoughts of an IT worker in the stone age of computer science.
Something occurred to me that, unfortunately, was just a little bit too big for a tweet, so I decided to blog instead, and add more context.
While thinking about the perennial question of whether static typing help reduce the number of bugs in an otherwise well tested code base, I was reminded of how many bugs I saw tagged by newer versions of Scala with improved static analysis and correctness, or how damn hard it is to do variance right when you start using it.
I was then struck by a thought: the "bugs" I was thinking of were not caught by tests because no feature in the code actually used the buggy class in a way that revealed the bug. This also relates to variance, because variance in Java is defined at the usage site, instead of definition site. The definitions are all invariant in Java (aside from arrays).
So, thinking about it, I came up with the following hypothesis:
Dynamically typed language proponents consider "bugs" to be things that the user of the software can cause it to do, while statically typed language proponents consider "bugs" to be things that users of the code can cause it to do. That would certainly account for some differences in attitude and beliefs I perceive. On the other hand, it might just be my imagination.