I have been watching the Google Hangout’s debate between Martin Fowler, Kent Beck and David Heinemeier Hansson concerning Test Driven Development and why we do it? The debate is titled ‘Is TDD Dead?’ a rather emotive title, guaranteed to grab attention! It worked with me. I’ve been using TDD for a number of years now and I must admit I’d rather use it than not. For me un-tested code is potentially full of bugs and very prone to becoming bloated and ‘smelly’. A good test harness helps prevent this, and it should also aid in understanding and documenting the code.
In the debate David HH takes the anti-TDD stance, not because he’s against testing code but he’s arguing against the ‘cargo cult’ that seems to have grown up around TDD. There is a danger with TDD in taking it too far. One of the comments many people make when first using TDD is that the code ends up in lots of little classes, so instead of searching throughout a large file for the relevant piece of code you end up searching through lots of files.
In the debates the person I’ve enjoyed listening to and the one I’ve admired the most is Kent Beck. He argues from a pragmatic, common-sense point of view. One thing I particularly liked was his emphasis on design. Kent Beck uses TDD to give him confidence in the code but he doesn’t use it to force a design on the code. I think that might be the crux of David HH’s argument.
Anyway tonight I’m going to attend a talk about ‘Is TDD dead?’ at XP Manchester. It will be interesting to know what others think.