July 9, 2013

...Learn TDD with Codemanship

Why You Should Learn TDD Before You Use It In Anger

Well, this probably goes for all sorts of skills, really. But I put TDD in the headline, because it glitters and excites.

This excellent blog post by Paul Ortins on lessons learned about TDD and unit tests correctly finds that it's usually a mistake to jump straight into real projects with new technical skills while you're still at the foot of the learning curve.

It's for the same reason that we don't read a book on swimming (or go on a short course) and then jump into the middle of the ocean and try to swim home. Many a TDD newbie has drowned when they tried to apply their very cursory grasp of the skills on a real project.

Better, as the poster suggests, to build up your skills in the safe and shallow paddling pool of FizzBuzz and The Bowling Game kata and gradually work up to the raging waters of a real, complicated software-project-for-money.

I have advised this for many years to people who come on my courses.

Where teams can tend to go wrong is they oversell TDD and the benefits it will bring, and fail to take into account the learning curve, which encourages unrealistic expectations. Unrealistic expectations are the gateway drug to crushing disappointment, acrimonious finger-pointing and, ultimately, loss of the vital oxygen of trust that software teams need to succeed.

The smarter way to do it is under the radar. Find some time every week to practice. Gain experience, learn the pitfalls and build your confidence. When toy problems become boring and too easy, progress onto harder problems, then onto using it on small parts of your projects (e.g., "just for today, let's test-drive our code on this new requirement".)

Eventually, you will be as confident and comfortable applying TDD to real problems as you were in your old way of working. (Very possibly more so.) But that's not a transition that happens in days, or even weeks, usually. And the pay-off, in terms of benefits that your customers or managers would notice, may not be visible for the first 6-12 months. Which is why it's so very important that you tackle it with a sense of realism.

Posted 4 years, 7 months ago on July 9, 2013