Coders Don’t Get Kata

The Concept of Kata Clarified for Techies

Garth Gilmour
5 min readJan 21, 2018

Most people have at least one thing they are into. Whatever that thing might be they know it inside out and speak the hidden language of the cognoscenti. So, regardless of whether its food, firearms or dancing the foxtrot, they tend to get really peevish when their special terms are misused out of context. And so it is with me and the term kata.

Software developers ‘borrowed’ the term kata from Japanese martial arts a few years ago. In the world of programming it refers to an exercise that is simple enough to be solved in a few hours, yet complex enough to help develop ones coding skills and/or illustrate some important point of a coding philosophy. Examples of simple katas include converting roman numbers and the bowling game.

Most books and articles that discuss coding katas present a brief homage to the original use of the term. These are always wrong, or at least too simplified to be considered correct. So for those techies who want to be precise, read on for an exhaustive meaning of what a kata actually is…

The Original Problem

Lets say you are a martial arts master living a century or more ago. You practise your own style but are fortunate to live on an island (such as Okinawa) frequently visited by traders from other lands. Some of these traders are experts in styles previously unknown to you, so you want to train with them, learn from them and incorporate they best of their technique into your own repertoire.

But there is a problem. You probably aren’t literate. Even if you are the written word is a poor medium for communicating the intricacies of human motion. As the years wear on your new knowledge will fade, and you will leave no useful records to pass on to your students. What do you do?

The Original Solution

The solution the masters ended up with was what looks like a strange solo dance, with the practitioner making various hand movements (including punches and kicks) punctuated by occasional changes in direction. This acts as a physical reminder which is practised daily till it becomes second nature. If the master has students they also end up practising the dance themselves (or perhaps a simplified version) but, and this is an important point, not necessarily knowing everything the dance represents.

A Concrete Example

To make things a bit more concrete lets take the opening moves of Pinan Shodan, a very famous kata created for beginners:

When I was a teenager I practised this kata hundreds of times, without really having a clue what it was about. It definitely didn’t help me in any of the tournaments I was entering and there were no clear applications for self defence. It was only much later that I learned how to decode the meanings in the movement.

Key Concepts in Kata

We have already covered the first point I want to get across, that kata is not necessarily about learning. It did become this way as the popularity of karate increased and it was exported to Japan, but along the way much of the meaning was lost and it became practise without purpose. In fact some of the loss of meaning may have been deliberate, since karate was sold to Japanese universities as a means of self-discipline rather than applied violence.

In time something coders would call an anti-pattern emerged, where it was generally believed that kata was about defending against attack from multiple simultaneous opponents. This led to widespread ridicule, since that only worked if the opponents attacked one at a time, in predetermined ways and along fixed lines.

Eventually however the arts reached a level of maturity where instructors began to revisit their roots and realise what was actually going on. So modern karateka do have some concept of the original intent (or so we believe anyway).

How the Orientation Works

The first big realisation was that the way you turn represents your orientation to the opponent. So when we turn to the side in the opening of Pinan Sandan we are not saying ‘this is how you defend when attacked from the side’, rather the author is saying ‘when attacked try to get side on and outside the line of attack’.

The three movements then represent different counters that can be applied. Having evaded and captured the punching arm you can:

  • Lift the arm high and deliver an uppercut
  • Trap the arm mid-level and punch over the top
  • Pull the arm low and apply a hammer fist

Here’s the concept being illustrated by Karate Kata expert Iain Abernethy

Making Sense of the Sequencing

Next note that it’s not a predetermined sequence. The three strikes could be performed in order, but any combination could work and any strike could be repeated. In terms of software design it’s like a flowchart with options for conditionals and iteration, but you have to know where they are to benefit from your practise. This is what modern instructors are seeking to reverse engineer.

What the Turns Mean

If you follow the Kata onward you see that we repeat the three strikes on each side (after all you might be fighting a southpaw) and then turn for a ‘block’ and kick. Originally this was interpreted as facing a new opponent attacking from directly behind, who had helpfully signalled he was intending to punch mid-level. The general understanding now is that the meaning is ‘having hit him one or more times move behind him, grab and twist to secure a grip on his shoulder and then kick out a knee’. This fells the opponent and thus completes the first part of the kata, as signified by a return to the original orientation.

The Implementation Varies

Another common misunderstanding you find when people describe kata is that some authors insist it was for basic techniques, whereas others for advanced ones. The answer is (confusingly) both.

It has always been the case in martial arts that a technique has many meanings. There is the version taught to beginners, the more effective one taught to senior students and a final version reserved for the masters prodigy. This should not be surprising when you consider that the masters livelihood was at stake and lethal techniques were being taught. So it was safer for everyone concerned to hold back the ‘good stuff’ till the students loyalty and maturity had been verified.

In this case there is a ‘level two’ interpretation of the above moves, involving an arm break and a throw. But fortunately you wont find that on YouTube :-)

Summing Up

It should now be clear why the term kata is so easily misunderstood, since at different times and by different people kata were:

  • Used for retaining knowledge
  • Used for acquiring knowledge
  • Used to conceal knowledge
  • Practised without any benefit
  • Practised to acquire secret skills
  • Disliked as a historical anachronism
  • Honoured as the core of the art

So you can see how the confusion arose :-) I hope this has clarified what the term means in its original context. If you are interested in learning more I recommend both the podcast of Sensei Abernethy and the book ‘The Way of Kata’ by Kris Wilder and Lawrence Kane. As a final example here’s a more advanced kata being performed by an astonishingly gifted 7yr old.

--

--

Garth Gilmour

Helping devs develop software. Coding for 30 years, teaching for 20. Google Developer Expert. Developer Advocate at JetBrains. Also martial arts and philosophy.