Static type checking is good, but…
|November 9, 2012||Posted by Stuart Gunter under Uncategorized|
Ignoring the usual arguments for/against statically/dynamically typed languages, there’s a more subtle danger I’ve seen lurking in the shadows of some statically typed programmers’ minds.
I’ve heard the words “it’s only JavaDoc” too many times to count lately. That seemingly innocuous statement can be pretty dangerous, because you’re in effect saying “I might have completely changed the meaning of what this class/method does, but it’s ok ‘coz it compiles” . You might be mislead into believing that a small change in documentation here or there is no big deal, but the meaning of the words you use impacts the expectations of the developer that’s using your code. Something as small as changing “will” to “should” can carry a significant semantic shift that might be a lot more devastating than perhaps changing the type signature. Statically typed languages might tell you when there’s a compilation error, but they will not always tell you when the contract has changed!
I don’t know what programmers using dynamically typed languages do – because I’ve only used them for playing around on pet projects (so far) – but I’d imagine (or at least hope) that a higher value is placed on docs than what I’ve seen in many programs written in statically typed languages.
If you’re not convinced, here’s a little something to mull over: if word choice is not important, then RFC 2119 was a waste of time!