Weakly Typed Dynamic Languages and Natural Selection

I’m not reading much in the way of blogs or twitter these days – way to heads down in my new job for that right now. But I did see Scott Hanselman’s post on method overloading and dynamic types and Ted Neward’s follow-on post static-typing fundamentalism. Even though I’ve moved on from the IronPython team, dynamic typing is a topic that’s still near and dear to my heart so I can’t resist throwing in my 2¢.

First off, I agree 100% with Ted’s post – though not the over-the-top mocking tone. These static > dynamic flame bait comments are so tired that they’ve literally become cliché. I agree with Ted’s points, but by answering fire with fire he’s just perpetuating the flame war that he claims to be so tired of. I really am tired of it, so I’m not going to bother to address any of the original anti-dynamic typing faux-arguments (fauxguments?) nor Ted’s artful and devastatingly mocking takedown of them.

But I do have a question for any static-typing fundamentalists in the audience: if static typing is so much better than dynamic typing, then how come dynamically typed languages are so popular? Doesn’t natural selection apply to type systems?

Those aren’t rhetorical questions. Building software takes time and effort. While developers often donate time and effort to projects (see: open source) typically they work for money. That money has to come from somewhere – usually it comes from someone who needs the software built for some business reason. And the people footing the bill for software construction demand the highest return on investment they can get.

If dynamic typing or VARIANT (which is actually weak not dynamic typing, but I digress) really did create “horrific devastation”, wouldn’t that have caused a negative feedback loop where the business people who actually foot the bills for creating software became wary and untrusting of using VB as the language of choice for their projects in favor of strong and statically typed languages that helped developers “make good choices”?

Yet the opposite happened. VB was the most popular programming language in the world for the better part of a decade. And while VB’s reign at the top is over, I’d argue that these days the most popular programming languages are PHP and JavaScript, both of which are weakly typed dynamic languages too.

Now clearly, popular != better. However, static-typing fundamentalism isn’t an argument about which way is “better” so much as an argument about which way is “worthy”. But how can you argue that you’re approach is the only worthy path when the opposite approach has been so successful? Remember, one developer’s “horrific devastation” might be another businessman’s “successful project because it helped me enter a new market faster than my competitors”.


You may have to look at the most successful set of patterns on the planet, and how dynamic typing may or may not help them. http://www.joeyoder.com/papers/patterns/BBOM/mud.html and...forget kittens! Dynamic typed languages are pumping hundreds of thousands of messages to/from surviving Haitians, in direct communication with low-level protocols from telecommunications companies. http://code.google.com/p/nuntium/
Nice post. Interestingly enough, the most statically typed languages are functional languages with strong type inference that removes almost any need for type declaration (Haskell, F#, etc). Funny enough, these functional languages come with REPLs just like the dynamic languages, so in the end, one must conclude it isn't static vs. dynamic; it's "script" languages that rule the world. ;)
I generally leave out JavaScript whenever I talk about "popular dynamic languages" simply because there were NO other alternatives to writing client-side code in the web browser. I loves me some JavaScript, but if you're the only man left on an earth full of women, you're gonna get some lovin'. PHP belongs on the popular list as does Python. People don't talk about Python a lot, but generally chugging away in academia or scientific research there's usually a bunch of Python scripts holding things together. re: static typing - I always smirk when I attend a talk or read a blog post about the latest compiler gymnastics you can perform on the CLR to avoid having to pay homage to a dead typing system. 90% of all the current design patterns and best practices vanish when you use a dynamic language IMO.