Coding Katas
Date Published: 18 January 2010
Last week at CodeMash I helped host a Software Craftsmanship PreCompiler on Wednesday afternoon. I also helped organize a coding dojo for the event, but it was very last minute and didn’t have a lot of instructions for developers new to performing katas. Having a room where people could get together and work through a problem together, perhaps in a new language, was still very worthwhile and totally in the spirit of CodeMash, so I’m not terribly disappointed. But next year, based on Sara’s experience, I think we definitely can do a better job of explaining some of the terms used and ways that one can improve one’s skills in such an environment.
Sara asked about what happened at the PreCompiler in her post’s comments, and I started writing this and it got rather long so I’m moving it to a post. For the Software Craftsmanship PreCompiler, we started it off with what I think Sara and I would both agree was a kata – an established way of performing a series of movements done by an expert and meant to be mimicked. For this, we literally walked the room full of people through the uncle bob bowling kata powerpoint, explaining each step as we went. Then, after making sure everyone had the PPT file themselves, we broke everyone up into pairs and did the problem ourselves in pairs (ideally doing ping-pong pairing, where one person writes a failing test and the other makes it pass). I did this problem on the projector with one of the audience members, so anyone curious about how it worked could see me.
In practice, not everyone paired, and not every pair got through everything. There are some basic requirements of individual participation, and you get what you put into it just as with karate. But most of the devs in the room got through the kata. I doubt any of them could do it again without following the ppt, but I couldn’t repeat seisan kata after watching my sensei the first time, either. You really do need to repeat these in order to “own” them.
The rest of the Precompiler we didn’t have the benefit of established experts’ versions of various problems, and Brendan and I wanted to introduce everyone to a variety of problems since I know they can go and repeat and practice on their own once they leave. So the next thing we did was a group design exercise called the SuperMarket Pricing kata. Here we just asked for groups of about 5 people (we had maybe 8 such groups) to discuss and come up with a rough design for how the objects would interact in a supermarket cash register, with pricing rules like 1 for $1, 3 for $2, buy 1 get 1 free, buy 2 of this get 1 of that, etc. After all groups described their designs to everyone, we paired up again and coded the problem. Not strictly what a martial artist would call a kata, for the reasons you mentioned in your post and with which I agree, so I tend to refer to these as "katas and exercises" for that reason. After that, in the precompiler, we did the FizzBuzz problem, which is pretty simple, and finally I introduced Langton’s Ant but by then pretty much everyone was burnt out and ready to call it quits, so only a handful of pairs worked on that.
Speaking of which, I first learned of that problemvia a kata done by Micah Martin at a Ruby conference last year. There’s a video of Micah’s katain which he explains his take on kata with code, including the important of the performance aspects of kata. Perhaps next year we’ll promote some performance of kata at the dojo as part of the experience.
Tags - Browse all tags
Category - Browse all categories
About Ardalis
Software Architect
Steve is an experienced software architect and trainer, focusing on code quality and Domain-Driven Design with .NET.