How big are your steps?

I re-ran my An Introduction to Test-Driven Development session yesterday…to an exceptionally interactive and responsive audience.

The slides are free to download here (1134k). Feel free to download the Delphi 5-7 code, the Delphi 8 code or the Visual code.

I was using DUnit with Delphi 7. I re-iterated the fact that eXtreme Programming and TDD extol the virtues of “doing the simplest thing that could possibly work”.

Read more about the session here.

Tied in with this debate was a lengthy discussion about the concept of “small steps”.

Early on in my session I took lots of really small steps, panicking the audience slightly as they wondered how long it would take me to get from 1 to 2000 in Roman numerals (I was applying TDD to a Roman numeral conversion class).

TDD promotes the notion of taking plenty of small steps, gradually taking slightly larger steps as your confidence increases. However, the instant you step over your mark and take a step that’s too large, you should revert to taking smaller steps until to regain your confidence.

The size of TDD steps is important and it’s one that you have to be happy with yourself: a “small step” that works for you might be a large step to somebody else. It’s about finding a happy medium – go out and try TDD for yourself, make the mistakes that I did, take large steps, try to do too much in a method and test. It’ll all come out in the wash and eventually as Erich Gamma said, you’ll be “test infected

Want to learn more about TDD? These books are highly recommended:

Test-Driven Development in Microsoft .net
Test-Driven Development: a practical guide

Test-Driven Development: a practical guide: Reviewed here.

Test-Driven Development by example