June 14, 2010

...Learn TDD with Codemanship

Codemanship Academy Alumni - I Salute You

For the last couple of years, I've been dedicating myself to an experimental coaching and learning process that is peer-led and practice-based called Peer Group Learning & Assessment.

During that time, several groups of developers have been going through PGLA programs in Test-driven Development, and more recently, Refactoring. I've been overseeing their PGLA programs and validating results in my capacity as an all-round brilliant person (and love machine). The results have been encouraging. Teams that did the TDD PGLA program saw real results in their code. Code was simpler and cleaner, and - unsurprisingly - better tested and more reliable. We have hard data to back this up from a dozen or so projects that paint a clear picture of the before and after. We continue to monitor that code to see the effect of scaling the practice up to 3 groups (with a fourth about to start), and tackling refactorings in more detail.

There are enough people engaged in PGLA now to warrant publicly acknowledging their achievements. So I've set up a web page on the Codemanship site where you can find out who's done it.

Some of you are probably thinking "hmmm, this looks suspiciously like certification to me". And, yes, it does a bit. But this is not a list of people who attended a course one weekend. I have spent months (and months and more months) working with these groups and their organisations. I've paired with all of them, and they've spent many hours over those many months pairing with each other and their internal coaches. It's no easy feat. Ask any of them whether PGLA was as easy as, say, getting to be a Certified Scrum Master. Many struggled to make the time. It was a serious commitment that they gave, and they put in some serious time to honouring it.

They also had one final hurdle to jump. And it's quite a high hurdle. To complete their PGLA program, they had to spend a day doing what they'd been practicing to do. And doing it to a standard that most of us would struggle to maintain for even an hour, let alone over the course of a long and gruelling day (the last hour is the worst, trust me!)

If you want to know how tough that might be, try this little exercise. Write down a list of a dozen good habits you believe you should apply when you're doing, say, TDD. It could be things like "write the assertion first and work backwards" or "never refactor if a test is failing" or "always run the test to check it fails in the way you expect it to", and so on.

Now, pick a simple coding exercise. For example, write a program that will generate a sequence of prime numbers of a specified length. Or that will calculate scores for a bowling game. Then try to implement the code needed to solve the problem doing TDD "by the book" (i.e., sticking to all the good habits on your list). Record a video of your desktop while you do it, then watch it back very carefully. Every time you catch yourself failing to apply one of those habits (e.g., you didn't run a test to see it fail), that's one strike. If you can spend an hour practicing TDD and get less than three strikes, and do that three hours in a row, you'll be doing very well. Especially if you can stick with the habits even at the end of a long and tiring day.

I'll bet you a shiny penny that it's harder than you might think it would be. Y'see, most of us know what we should be doing, but few of us actually do those things - not habitually, anyway. PGLA is about building those habits and instincts. It takes a long time and it's no small achievement.

The lovely people listed on the Codemanship Academy page have proved their metal in a way that very few developers have. They've proved that, even when they're tired and stressed and the pubs are open and it's time to go home, they can still do TDD to a standard higher than most of us apply when we're full of vim and vigour and raring to go.

And how many of us can honestly say we do that, too?

Posted 7 years, 11 months ago on June 14, 2010