Years ago, I’d heard all the advantages of TDD. Cleaner designs, improved productivity, more confidence in your code. But nobody told me that it would turning coding, at least for a reluctant pseudo programmer like me, into a game.

How you ask?

Firstly, as with all games, it’s rule-driven. Sure, you have to define the rules yourself, but once the test is written, there are guidelines that define what you’re doing.

Secondly, like in many good games, when you take an action there’s immediate feedback. Run into a ghost and you die. The ball hits the ground and you lose. Run the test and it fails.

Finally, it automatically keeps score for you. 79/81 tests passed. Please try again. And even better, the more you write, the more the score goes up.

Notice that these are also perfect conditions for flow… not a coincidence I think.

Advertisement