For some reason this whole Code Kata movement passed me by, so I'm coming late to the party, but I'm getting hooked.

The term kata comes from Japanese martial arts and means "detailed choreographed patterns of movements practiced either solo or in pairs" (wikipedia). The intent is to practice and practice some sequence of movements until it becomes second-nature, flowing, and effortless. Repetition, practice, training.

When applied to programming, it's the same intent. Every day, you take 30 minutes or so and and write some code; the same code every day. It's like practicing scales when you learned how to play the piano: every day you'd repeat the same scales, getting better at doing them, polishing, polishing.

The object is not necessarily to think of different ways of implementing the same solution, but to practice writing the same implementation from scratch every day, and throw everything away at the end of the session. You are learning your development tools through repetition; you are rehearsing your basic programming skills; you are not writing code for posterity.

Many code katas emphasize TDD. That is, once you've worked out the solution to your kata problem, you work through building it test-first and practice doing it. Perhaps you'll see different ways of working your way through the red-green-refactor cycle and slowly modify your approach. But again it's not particularly about that, it's about rehearsing your coding abilities for a certain set time every day, no matter what else happens that day.

I was talking to my old friend Maxx about this recently because we were both bemoaning the fact that we hardly program any more, and we really wanted to get back into it, to feel the Zen of being able to write code quickly and effortlessly. This is one way to prepare ourselves for that.

For some examples of code kata, check out these sites:

  • Dave Thomas' Code Kata site with 21 kata ideas on the right sidebar. Dave Thomas is one of the Pragmatic Programmers, of course.
  • "Uncle" Bob Martin has a couple of good examples: the Bowling Game Kata (which is actually quite difficult to solve elegantly in the first place, I think), and the Prime Factors Kata.
  • Roy Osherove has a fairly simple kata designed to practice those TDD skills: the String Calculator Kata. There are several solutions shown in different languages: feel free to copy them (after all, the point is not to shown off how clever you are in your solution — you're doing this for yourself, remember).

I've started with Roy's suggestion and once my kata session is elegant and effortless (!), I'll record it for a DevExpress video (since I'll be using CodeRush).

Album cover for Outlandos d'AmourNow playing:
Police - Roxanne
(from Outlandos d'Amour)



Posts on similar topics...

1 Response

  • Thu 25 Feb 2010
  • 7:21 AM
  •  avatar #1

Dew Drop – February 25, 2010 | Alvin Ashcraft's Morning Dew said...

Pingback from Dew Drop – February 25, 2010 | Alvin Ashcraft's Morning Dew

Leave a Response

Some MarkDown is allowed, but HTML is not. (Click to learn more.)

  • Emphasize with italics: surround word with underscores _emphasis_
  • Emphasize strongly: surround word with double-asterisks **strong**
  • Link: surround text with square brackets, url with parentheses [text](url)
  • Inline code: surround text with backticks `IEnumerable`
  • Unordered list: start each line with an asterisk, space * an item
  • Ordered list: start each line with a digit, period, space 1. an item
  • Insert code block: start each line with four spaces
  • Insert blockquote: start each line with right-angle-bracket, space > Now is the time...

Extras

Search

About Me

I'm Julian M Bucknall, an ex-pat Brit living in Colorado, an atheist, a microbrew enthusiast, a Volvo 1800S owner, a Pet Shop Boys fanboy, a slide rule and HP calculator collector, an amateur photographer, a Altoids muncher.

DevExpress

I'm Chief Technology Officer at Developer Express, a software company that writes some great controls and tools for .NET and Delphi. I'm responsible for the technology oversight and vision of the company.

Validation

Validate markup as HTML5 (beta)     Validate CSS

Bottom swirl