Sitemap

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

8 min read20 hours ago

--

Press enter or click to view image in full size
Killing tests — Generated by the author.

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.

--

--

David Rodenas PhD

Written by David Rodenas PhD

Passionate software engineer & storyteller. Sharing knowledge to advance our skills. Join me on a journey of discovery in the world of software engineering.

Responses (1)