What's your favorite Kata? 15
I’m looking to collect several katas for the OkC CoCo Dojo to make sure we have plenty of future practice sessions already in place. Ultimately I want it to be at least bi-weekly (or weekly) and self sustaining. Along those lines, I’d like to hear what are your favorite katas.
I’d prefer you mention things you’ve tried yourself. Please post links and your impressions in response to the blog. I’ll collect them here, and let me know if you’d like me to credit you with pointing me to the idea (or for the idea itself if you created it).
FWIW, after a little thinking, my favorite kata based on the number of times I’ve used it in one manner or another is Monopoly®.

@Brett
You said:
I followed the Monopoly hyperlink to your site and counted the number of times you say you have used this Kata (ignoring ‘some times’ and ‘a few times’), and came up with an astonishing 170+ times.
This single figure has definitely improved my appreciation of the role that Katas can play in a professional’s work.
Thanks for sharing the monopoly material on your site.
Some suggestions:
Given a set S of strings, decide whether a specific string t is a prefix of exactly one member of S. I found this useful in JOpt Simple, which allows abbreviations of command line switches if a switch is a unique abbreviation—so if your command line accepted -c and—cool, specifying—co would be interpreted as though you had typed—cool, whereas—c would still count as -c.
Which reminds me: command line switch parsers might make a good kata.
Data structures—Bloom filters, skip lists…
Years ago, I was aware of the impact the Monopoly project had on my use of formal methodologies. Specifically The Fusion Method by Coleman and later the UML and UP.
We used this problem in both language classes as well as process classes so that’s why such a large number of times for me.
Until I wrote that page, I did not really understand how I had been using it as a Kata. That was quite of a realization for me.
I just got off a flight from ORD -> LHR, where I worked on Monopoly again using Mockito and I found myself struggling to keep to a strict mock approach and also envision a different solution for one particular part of the problem where violating the LSP makes the problem easy to solve, but I cannot think of a “great” solution, I’m just selecting from the one that sucks the least.
FWIW, that’s my definition of design: Select the solution that sucks the least. Somewhat modified now to include (for what I know now), with the assumption of automated test coverage…
Glad you enjoyed it. I’m hoping to use it again in a future dojo at the OkC coco.
@Brett
In chapter 3 of ‘Holub on Patterns, Learning Design Patterns by Looking at Code’, Allen Holub says:
Holub has a goodies page dedicated to the game.
It seems that quite a few people are using Life as a kata. I first came across the idea in Uncle Bob’s The Programming Dojo.
Here is the opinion of someone at CodeRetreat:
And this chap goes as far as saying the following:I had a go at coding Life a few months ago. Now I am doing it a second time using TDD: I want to see how different they turn out.
Have you used it as a kata before?
@Brett
As Kirk Knoernschild says in Java Design – Objects, UML and Process:
If I do a kata with both an OO language like Java, and a functional language like Haskell, I can’t help observing that in the former, I am mostly practicing how to deal with accidental complexity, whereas in the latter I am mainly practicing how to deal with essential complexity.
This begs the question: if I we are soon all going to be able to use functional languages in our day jobs, won’t all the skills we have acquired by doing katas in OO languages become worthless or seriously devalued?
E.g. one of the Katas you have collected is Uncle Bob’s Bowling Game Kata.
On the one hand, I like this Kata, and up to now it is the one I have practiced most, using Java. But some time ago I did the kata using a functional language like Haskell. If you look at the end result
it is kind of obvious that the kata was mainly about dealing with essential complexity.
In the Java version of the kata instead, while the end-result is relatively uncomplicated thanks to its cleanliness
public class Game { private int currentRoll; private int[] rolls = new int[21]; public void roll(int pins) { rolls[currentRoll++] = pins; } public int score() { int score = 0; int frameIndex = 0; for (int frame = 0; frame < 10; frame++) { if ( isStrike( frameIndex ) ) { score += 10 + strikeBonus(frameIndex); frameIndex += 1; } else if ( isSpare( frameIndex ) ) { score += 10 + spareBonus(frameIndex); frameIndex += 2; } else { score += sumOfPinsInFrame(frameIndex); frameIndex += 2; } } return score ; } private boolean isStrike(int frameIndex) { return rolls[frameIndex]==10; } private boolean isSpare(int frameIndex) { return (sumOfPinsInFrame(frameIndex)) == 10; } private int strikeBonus(int frameIndex) { return rolls[frameIndex+1] + rolls[frameIndex+2]; } private int spareBonus(int frameIndex) { return rolls[frameIndex+2]; } private int sumOfPinsInFrame(int frameIndex) { return rolls[frameIndex] + rolls[frameIndex+1]; } }at some points in the TDD journey from first failing test to end-result, the code morphs into something quite ugly (see slides titled ‘Fourth Test’ in Uncle Bob’s Powepoint Presentation) whose complexity is accidental in that it stems from the fact that we are using an imperative language which requires us to tell the computer HOW to compute the score by manipulating state, rather than telling it WHAT to compute using side-effect free functions, like in Haskell.
What do you think? Do you ever think that some of the refactoring we do in imperative language katas is a bit pointless?
? ? ?? ???
Have a look at http://www.codingdojo.org where some of us have been collection our own experiences.
Good post….thanks for sharing.. very useful for me i will bookmark this for my future needed. thanks for a great source.
I just love to read stuff like that
Right I understand what you say, I learned from you is very help me.
so what ?
http://www.ipadvideoconverters.biz iPad Video Converter iPad Video Converter is a great software for iPad lovers to convert videos to iPad with super fast speed and high quality. Its easy-to-use interface makes iPad to videos conversion routine very simple. And also it can keep the original quality of video files.
MTS Converter can help you to convert mts files easily and quickly, and it is very easy to use. if you are in need, you can download it and experience by yourself.
Main Features of MTS Converter
that it stems from the fact that we are using an imperative language which requires us to tell the computer HOW to compute the score by manipulating state, rather than telling it WHAT to compute using side-effect free functions, like in Haskell.
What do you think? Do you ever think that some of the refactoring we do in imperative language katas is a bit pointless?cheap VPS
Good post….thanks for sharing.. very useful for me i will bookmark this for my future needed.