Red Squirrel Reflections
Dave Hoover explores the psychology of software development

Dave Hoover
dave.hoover@gmail.com

Categories
All [Atom]
Craftsmanship [Atom]
Dynamic [Atom]
Intersection [Atom]
Learning [Atom]
Links [Atom]
Polyglot [Atom]
Projects [Atom]
XP [Atom]
Old Blog

Obtivian Blogs

Andy Maleh
Colin Harris
Fred Polgardy
Jake Scruggs
Kevin Taylor
Renzo Borgatti
Ryan Platte
Todd Webb
Tyler Jennings

Archives

June 2008 (4)
April 2008 (3)
March 2008 (1)
February 2008 (1)
August 2007 (1)
July 2007 (1)
June 2007 (1)
May 2007 (4)
April 2007 (3)
March 2007 (5)
February 2007 (6)
January 2007 (6)
December 2006 (10)
November 2006 (5)
October 2006 (8)
September 2006 (8)
August 2006 (5)
July 2006 (12)
June 2006 (7)
May 2006 (5)
April 2006 (5)
March 2006 (4)
February 2006 (2)
January 2006 (5)
December 2005 (5)
November 2005 (3)
October 2005 (3)
September 2005 (6)
August 2005 (4)
July 2005 (7)
June 2005 (14)
May 2005 (6)
April 2005 (8)
March 2005 (9)
February 2005 (11)
January 2005 (16)
Old Archives

 

Thu, 22 Dec 2005

My take on Dynamic vs. Strongly Typed

Update: Dave Astels has alerted me that I am mixing some orthogonal concepts in this post. I'll leave the post as-is, but it looks like I'll need to hunker down and educate myself a bit more before I spout off about this stuff again.

I've followed a recent thread of blog posts that will probably spawn several more threads over the next few days and on into eternity as the conversations and debates over dynamic vs. strongly typed languages perpetuate themselves. This particular thread has not provided a compelling argument either way, but it does bring up some critical issues: 1) the safety provided by strong typing, and 2) the safety provided by strong testing.

I've been programming for 5 years. The first half of those 5 years was spent writing all sorts of Perl code. I remember people shaking their heads (in pity, I think) when they heard I was learning to program with Perl, and I always wondered why. I understand now. Dynamic languages like Perl are insanely powerful. It's like giving a Harley Davidson to a 16-year-old. They're going to do some damage: it's just a matter of time. And with Perl, I did some damage, but I also got it under control and began to use it responsibly.

And then I switched to Java. I was excited to learn Java because it had such a huge mindshare advantage over Perl (not per capita, but just by sheer numbers). I remember the strange constraining feeling of declaring types for the first time. It felt different, but I liked how explicit the code looked when I read it. It was comforting to use a compiler, and the IDE's were incredible!

At the same time I was teaching myself Java, I was beginning to practice test-driven development. Over the second half of these 5 years, I have come to value TDD as the most fundamental practice in my toolbox. It is an enabling practice that allows me to refactor mercilessly and evolve designs incrementally.

Over the last year I have had the opportunity to get back to my dynamic language roots. I've spent about a quarter of my time in Perl and Ruby. Coming back to dynamic languages I have observed two important phenomena: 1) I am suddenly interested in contributing to Open Source again, and 2) (Dynamic languages + TDD) == (power + safety) == confidence.

The comment that spurred me to write this post was from Simon:
Strong testing is fabulous, no doubt about it: the problem is that most developers don't have the discipline to write and update their test suites. The consequence is that, in the real world, there actually are benefits to static typing in complex projects. One way of thinking about static typing is as "just another test suite", except that it's a test suite developers are less likely be lazy about or subvert.
I couldn't disagree more, on so many levels. And comments like these speak volumes about the different perspectives we take as an industry. I currently live in the real world of a complex project written in a static langauge, and I observe daily what little difference that compiler makes in the face of a mountain of untested code. If you don't have the discipline to write tests for your software, then please stop writing software, and by all means, don't use dynamic languages. If people choose strongly typed languages because most of their developers are undisciplined, they've already lost. Paul Graham has more to say about this.

I'll sign off with this thought from Justin and Stuart...
The "safe language" argument appeals to fear, while the "flexible language" argument appeals to a sense of opportunity and adventure. Both are powerful motivations, so for a long time this argument has been a stalemate. Happily, that period is coming to an end. Two new factors have come into play: automated testing and transparency. Over the next five years they will turn the balance totally in the favor of more flexible languages.

[/dynamic] permanent link


powered by blosxom