29 Apr 2010

TDD next step evolution: (almost) no tests

Disclaimer: I don't think you can understand this until you used TDD for a few years...

I have to admit I do TDD less and less (shame on me). But that's strange because my code quality doesn't decline that much?!

I noticed it but I couldn't put words on it untill guess who twitted about about a blog article: "TDD without the T".

Simply put:
1- first you code without tests, you make bugs, crappy code and it freaks you out (if you're a control freak)
2- you write tests and you get confidant again (even if you know your tests don't catch all bugs)
3- you write more and more tests but you become enable to start a simple little program/idea just for fun because you need to setup all the tdd(ish) components before you can actually start something
4- you don't write tests and you realize that you now write better code and do less bugs (because you've written tests for so many years)

This evolution process span on many years but that's my current understanding of TDD after starting to use it back in 2003!

That doesn't mean I don't write tests, I just write them when I think they are necessary, when I want regression suite, when I realize something is becoming to complexe to simply launch it and see if it works etc...

For my latest pet project: http://code.google.com/p/gmail2ldap/
I didn't write any tests because code was just about wiring ldap + gmail contact api.
Unit code was useless.
Making a functional test suite was too complexe for a little program like this.
I'm actually happy I didn't make any test!

Take a look at this article, you'll learn stuff: http://coderoom.wordpress.com/2010/04/27/tdd-without-the-t/

1 comment:

Unknown said...

It works well for a small tool with one developper on it. I would not recommend this for a production project with more than 2 junior dev on it :o)