Eleanor McHugh (feyeleanor) wrote,
Eleanor McHugh

  • Mood:

Donal Knuth on test-driven development

An excellent interview with one of the giants of computer science which supports my own views on the matter marvellously:

As to your real question, the idea of immediate compilation and "unit tests" appeals to me only rarely, when I’m feeling my way in a totally unknown environment and need feedback about what works and what doesn’t. Otherwise, lots of time is wasted on activities that I simply never need to perform or even think about. Nothing needs to be "mocked up."

Of course it's not entirely surprising considering that Knuth's The Art of Computer Programming had a strong influence on me as a teenager. Another couple of gems from the interview that I wholeheartedly agree with:

Still, I hate to duck your questions even though I also hate to offend other people’s sensibilities—given that software methodology has always been akin to religion. With the caveat that there’s no reason anybody should care about the opinions of a computer scientist/mathematician like me regarding software development, let me just say that almost everything I’ve ever heard associated with the term "extreme programming" sounds like exactly the wrong way to go...with one exception. The exception is the idea of working in teams and reading each other’s code. That idea is crucial, and it might even mask out all the terrible aspects of extreme programming that alarm me.

I also must confess to a strong bias against the fashion for reusable code. To me, "re-editable code" is much, much better than an untouchable black box or toolkit. I could go on and on about this. If you’re totally convinced that reusable code is wonderful, I probably won’t be able to sway you anyway, but you’ll never convince me that reusable code isn’t mostly a menace.

I see much reusable code that is blindly assumed sound by its users because it passes various unit tests etc., but that if you take the time to actually read the source code is as dirty as hell. I could rant about code cleanliness for days on end - in large part because I've worked on multi-year projects and being able to get back into the code after an extended break is a key requirement for me.
Unfortuately on the subject of extreme programming I think Knuth is mistaken to believe it focuses teams on reading each other's code. It's true that this happens on a pairwise and ad hoc basis, but there is little pressure for any one developer to read the whole codebase and unless the autromated tests fail the chances are that most developers will never explore more than a small portion of the codebase they're working on. As reading and critiquing code in-the-large is an essential skill for anyone who wants to truly master programming, I wonder how many will do so on their own initiative and how many will prefer to lurk in their own personal pool of mediocrity.

  • Back in the US again in October:)

    In mid-October I'll be speaking at Strange Loop in St. Louis about Google's exciting new systems language Go and my open-source GoLightly project.…

  • Letter to my MP regarding the Digital Economy Bill

    Dear Andrew Love, Thank you very much for your letter dated 22nd March in response to my email enquiry concerning the Digital Economy Bill. I…

  • To Dream of Real-Time Ruby?

    My RubyConf 2009 proposal which alas didn't make the cut. Summary Ruby is a beautiful language, and because of that beauty we tend to ignore the…

  • Post a new comment


    default userpic

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.