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
Jim Breen
Kevin Taylor
Todd Webb
Turner King
Tyler Jennings

Archives

March 2009 (1)
January 2009 (1)
December 2008 (1)
October 2008 (3)
September 2008 (1)
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

 

Fri, 23 Dec 2005

Canvas, Ajax, and the Supertrain

I've written a tutorial on how to combine canvas and Ajax. In this article I use canvas to graphically represent the real-time state of a fictional railway system (live example). Send me feedback if you have suggestions for improvements.

Merry Christmas!

[/projects/ajaxtrains] permanent link

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

Thu, 15 Dec 2005

Canvas Creeping Forward

With the release of Firefox 1.5, I expect to see an increasing number of people experimenting with the canvas tag. The Ajaxians posted Romain Guy's cool Crystal CD case effect. Consider taking advantage of canvas and Ajax for real-time graphical data presentation. They're an awesome combination.

[/links] permanent link

Mon, 12 Dec 2005

The Empty Cup

Despite my growing number of distractions (Ajax, Rails, Selenium), I still have at least part of my attention on the apprenticeship patterns. One of the nice things about writing about this stuff is that examples of the patterns are everywhere in a typical software project lifecycle. I wrote up an example of Expose Your Ignorance for my latest StickyMinds column: The Empty Cup.

[/craftsmanship] permanent link

Fri, 09 Dec 2005

Selenium on Rails

Once again I find myself distracted from my writing. Last time it was Ajax, and this time it's the killer combination of Rails and Selenium. I've joined the Selenium project to help improve the dynamic language drivers. My first goal is to integrate "driven" Selenium with Rails. Last night I spiked it against a partially developed Depot. Here's the test case:
require File.dirname(__FILE__) + "/seletest"

class ExampleTest < Test::Unit::TestCase

    def test_something

        open '/admin/list'

        verify_text_present 'Listing products'

        click_and_wait 'newProduct'
        click_and_wait 'commit'

        verify_text_present 'Price should be positive'
    end
end
And here's a screenshot of Selenium driving Rails.

As I added to the number and complexity of test cases, I followed Brian's advice and moved to a more declarative style. I'll have more to say about this in the weeks ahead.

[/projects/selenium] permanent link


powered by blosxom