The Real Intent of Code Katas

When I first heard about code katas, I was intrigued. The name sounds cool and promises to make me better at coding. But until recently I had the wrong picture of code katas in my mind. I thought it’s solving a problem over and over so that in each iteration I would write down a better solution than before. In other words: the previous runs of this kata inform the next one.

But I wondered: What amazing problems are there that you still benefit from solving them for the 101st time?

I found the answer in a video of Uncle Bob. The main idea of code katas is not finding a better solution. Instead, you do the very same actions over and over, similar to martial arts katas. The main idea of a kata is to strengthen muscle memory. Applying it to software engineering, we could say code katas strengthen muscle memory in your fingers on your keyboard. Indeed many katas are test-driven-development-heavy and involve a lot of refactoring that require many key combos for your IDE.

Uncle Bob says code katas help him recognize moments during coding that require a certain refactor (and corresponding keystroke) and since this is done automatically, it leaves his mind to focus on the real problem.

I think this can be generalized from keystrokes for refactorings and red-green-refactor cycles, to more abstract higher-order thinking. For example, knowing a design pattern and when to use it, you can then do exactly that when the right situation arrives, and you can do that with minimal mental effort.

In fact, this reminds me of an idea from Steve McConnell’s Code Complete1, that

“The purpose of many good programming practices is to reduce the load on your gray cells”.

This comes from the fact that our minds and intelligence are limited by several orders of magnitude compared to the typical problems we face.

So the overarching lesson here is to accept our own limitations as coders and continuously search for ways to keep our minds as free as possible (from unimportant details) so that we can focus on what we pride ourselves with: solving problems.


  1. Code Complete 2nd edition, chapter 33.2 Intelligence and Humility ↩︎