Take Your Test Driven Development Bowling, … Take it Bowling

By | December 22, 2014

In case you are wondering, the title is a take on this song, Camper Van Beethoven – Take The Skinheads Bowling. It’s a stretch, I know but I found it funny.

In a previous post I mentioned how much of a fan I was Uncle Bob Martin’s books, Clean Code and Clean Coder. In Clean Coder Martin talks about coding kata. The word kata is taken from martial arts and is a form of practicing moves in a systematic and repetitive manner, until muscle memory is developed, so that successful techniques in martial arts become instinctive.  So the idea behind code kata is the same.  Practice common patterns and best practices in a deliberate, systematic, and repetitive manner so that when writing production code the best practices and common patterns are instinctive.

One kata that I found very helpful for Test Driven Development (TDD) is the Bowling Game Kata.  The kata is actually defined in a PowerPoint presentation that is linked at the beginning of Martin’s article, so be careful not to miss it.  The reason I find this kata so helpful is because I have not been fortunate enough to work in an organization with significant discipline around writing unit tests and I especially like the idea behind TDD.  In the Bowling Game Kata Martin takes the practitioner through the steps of writing code in a TDD manner.  I also think a subtler point in this kata is that you also get an idea of how Martin refactors code continuously in order to achieve “clean code”.  And the “safety net” that ensures the continuous refactoring does not break the functional requirements of the code are the unit tests, which are created first, before the code the tests are meant to validate is even written.

Also not that the results of this kata have any real value, (In this particular case it really is the journey that matters and not the destination.), but I have the source code on my GitHib account as well if you are interested.  Bowling Game Kata

I hope you found this helpful and if you are looking for more code kata a Google search will turn up quite a few resources but here are a few.


The last one also has pictures of cats, because everyone on the interwebs likes pictures of cats.



Leave a Reply