Monday, November 26, 2007

Why "Type-Safe" Languages Don't Cure All Ills

Whenever I show someone the wonder that is a dynamic duck-typed language like Ruby, they always balk at the idea initially. “Where are my types?” “Won’t that cause a whole world of headaches with incompatible data types?” “Isn’t it safer to use types so that bad data doesn’t get in?”
What if the problem has to do with metric vs. ‘standard’ (i.e imperial) measurements? Types won’t save your ass then, they certainly didn’t save the Mars Observer.

From The Top 10 IT Disasters of All Time

5. Mars Climate Observer metric problem (1998) 
Two spacecraft, the Mars Climate Orbiter and the Mars Polar Lander, were part of a space programme that, in 1998, was supposed to study the Martian weather, climate, and water and carbon dioxide content of the atmosphere. But a problem occurred when a navigation error caused the lander to fly too low in the atmosphere and it was destroyed.
What caused the error? A sub-contractor on the Nasa programme had used imperial units (as used in the US), rather than the Nasa-specified metric units (as used in Europe).
I actually remember one of my profs. discussing this very thing in class last Fall, but he wasn’t even talking about dynamically typed languages, he just offered it as an aside during a discussion about types.
I figured I’d post it since I haven’t blogged in months. Woo. So ends the hiatus. Damn microblogging (Twitter) has kept me off the blogspot for too long...