Member-only story
The Test Code You Write to Learn vs. The Code You Keep
What two versions of the same Kata taught me about temporary code and learning
Without a doubt, one of the best ways to learn programming testing is to follow Robert C. Martin’s Bowling Game Kata. This programming Kata contains so much wisdom that it’s difficult to learn it all at once, and therefore, it asks you to repeat it time and time again. And despite this, and despite the fact that I did it for the first time over ten years ago, and I’ve repeated it dozens of times, if not a hundred, it’s surprising that I can say I still find new things.
In several articles I’ve talked extensively about the Bowling Game Kata. About concepts like how it shows how we can refactor code without stopping production, how we should name our tests, and even what we should test and at what level. And one of the concepts that appears in the Bowling Game Kata is step tests, small tests that you do to build the code you’re itching to write. Tests that you know you’ll delete because they’re not any logical part of the application and yet you do them. You do them because you know you’ll need that class, and you’ll need that method and you can’t wait to do the complete test to have it, because you prefer to go little by little.