Static v Dynamic (and Gavin on ActiveRecord)

Bob has a post today about a Gavin King blurb on ActiveRecord that warms the cockles of my heart. I have been to a few conferences (and other gatherings) lately where it was all the rage to bash statically typed languages (Java in particular) and gush about those that are dynamically typed (Ruby in particular).

I think both have a place, obviously, but I don't think dynamic languages will *ever* completely replace static ones, as much of the current thinking seems to go. There are hard limits to what can be inferred dynamically, and there are actual computer science based reasons why static languages were invented - it was not just a cruel ruse to make development more difficult.

One platform to run both on is great, I will not argue against that (JVM/CLR, etc), but I also don't think dynamic languages scale well on large projects.

Now, let me clarify that. I haven't used Ruby much, but I have used things like PHP and JavaScript. I know neither of these compares to Ruby, right?, but still the dynamically typed, and dynamic runtime nature apply. JavaScript is a great language, but it is too variable for my taste (and that variability confounds tooling). So, what I mean is not that these languages *can't* scale, but rather that they require a lot of *discipline* to do so - whereas static languages bake some of that in. Granted, the Ruby/JavaScript analogy may have many flaws on the finer points, but on the big stuff it seems to me to apply. Idioms, tooling, refactoring, testing, etc, these matter.

Now, one of my friends pointed out to me, very astutely, that you can write crappy code in any language - so discipline always matters. As Neal Ford put it (in a recent presentation espousing the good of dynamic languages) "Bad developers will move Heaven and Earth to write bad code." That fact somewhat minimizes the static arguments, but not entirely.