February 15, 2009

...Learn TDD with Codemanship

If You Want To Be Truly Agile, Work On Your Developer Fitness

Do you recall an exercise you might have done to improve your fitness - perhaps at school or as part of a sports team - where you have to run up and down a 50m track, reaching each end before a buzzer goes off? And with every few lengths, as you get more and more tired, the buzzes get closer and closer together, forcing you to run faster and faster?

The exercise starts slow and well within your comfort zone, but little by little and before you know it, you're soon outside that zone and discomfort turns to pain.

I did it at school as part of our PhysEd and it still fills me dread. 20 years later and I can still feel that lactic acid burning in my calves and my thighs. Nasty!

If you're especially unfit, it's really not a good idea to attempt this exercise. Certainly it would hurt you, and probably put you off exercise for life. It could even kill you!

I've noticed a similar pain among a lot of teams attempting to go Agile. Teams go from 6-12 month+ marathons to suddenly delivering something every fortnight. And to start, it feels reasonably comfortable with those first two or three iterations. But in unfit teams, the software equivalent of lactic acid - namely "technical debt" - starts to build up, and incrementally delivering new features gets harder and harder and more and more painful.

But their Scrum Master continues relentlessly to bang the iteration drum every two weeks. And the teams feel that somehow they should still be delivering, but steadily and surely the technical debt becomes insurmountable as they never get time to catch their breath.

Fit teams have programming muscles that build up lower, manageable levels of technical debt, and are recognisable not just by the higher quality of the software they deliver but by how long they can deliver at the same productive pace.

This sustainable pace is the foundation of the whole Agile premise. If you are too out of breath after a year or two of development to deliver the changes the business needs as quickly and as economically as you could have done if they'd asked for them in the first few iterations, then as far as I'm concerned you have failed at being Agile.

Developers build fitness just like athletes do: through exercises and through continual practice. They must make time in their day to do the software equivalents of push-ups, star jumps, sit-ups and running. They must be careful and conscientious to do the exercises properly, just as athletes must not cut corners when they exercise, or else they may not improve. When you do push-ups, for example, your body should be straight, your hands should meet the floor directly below your shoulders, your nose should just touch the floor when you go down and the arms should end fully extended when you push up. If you do lazy push-ups, you won't really feel the benefits as much. Take the time to do them right, and your strength and stamina will improve much faster.

When you practice Test-driven Development, you should also take the time to do things right*. Make sure you choose a meaningful test method name. Make sure you write the test assertion first and work backwards from there. Make sure you run the test to see it fail in the way you expect that it should. Make sure you write the simplest code necessary to pass the test. Make sure you refactor to remove duplication after every test. Don't refactor while you have a failing test. Don't change the meaning of a test while you're refactoring. And so on. Do it slow enough to do it right, and let your speed build up naturally as you grow more comfortable with the exercise.

Over time - days, weeks, months and years - your developer fitness will improve to levels you might not have thought you'd ever reach. And that hour a day you gave up to practice will pay for itself many times over.

Fail to do this and I absolutely guarantee that you and your team will be doomed to an eternity of dragging yourselves over the finish lines panting and wheezing long after the real athletes would have crossed them in triumph and with smiles on their faces.

And whether you like it or not, you'll never be genuinely Agile.




* And yes, Jeff and Joel, when we're practicing we do things exactly as prescribed until we're fit enough and strong enough to do things "freestyle"

Posted 9 years, 4 months ago on February 15, 2009