2003, The year of the test

Looking back on my blog entries for 2003 it’s reasonably obvious that the big thing for me in 2003 was testing. TDD seems to work well for me and my clients. It’s not a silver bullet but it is a useful tool and I find that when you’re operating in TDD mode that nice code just unrolls in a nice, stress-free manner. What’s more, the code usually seems to turn out better than that produced without using TDD. The structure and design is more flexible.

Adding tests to existing code is harder but equally worthwhile. This year I hope to start pushing testing into my “back catalog” of code.

In Q1 this year I have a couple of pieces of client work that will require me to work with the server framework that I’ve been developing for clients for the past couple of years. This framework comes from the time before I realised how useful unit tests are. The Server Framework has tests but they’re single, monolithic, black box, test the server as a whole, type tests. They prove that The Server Framework works but they don’t improve the quality of the code and it’s often hard to locate the cause of a test break because the granularity is wrong (1 test per server, hmmm). So this year I hope to push tests into The Server Framework code base. That will require restructuring and refactoring but that’s OK. With care we can end up with better code; code that’s easier to keep working.

I still find TDD a hard discipline. It’s tempting not to do it and even though I have reams of blog postings to remind me of how useful I find it I still don’t always do it. This year’s resolution is to try and make sure that I use TDD whenever it’s appropriate rather than whenever I remember.