Code ‘Kata’

Michael Jacobson
3 min readFeb 26, 2018

--

“To practise kata is not to memorize an order. Find the kata that work for you, understand them, digest them, and stick with them for life.” — attributed to Master Gichin Funakoshi , 10th Dan

Master Hirokazu Kanazawa, 10th Dan

Coming from a martial arts background, I’ve always found the term kata, as it is widely used in programming circles, slightly jarring. The Japanese word kata (typically represented by one of the following kanji: 型 or 形) is usually translated literally to English as ‘form’. As a student, and later teacher, of Karate-Dō I learnt and routinely practised numerous kata.

In the traditional Japanese martial arts context, kata are set sequences of choreographed moves — steps, turns, strikes and blocks. Each kata is a representation of a bout of combat between the defending karateka and several attackers. These kata are practised hundreds, or thousands, of times by students, typically under the supervision of a sensei who will offer feedback and constructive criticism throughout. Kata are practised for months, or even years, on end, until the student has achieved something approaching mastery of the moves, or at least a true understanding of them. While there is occasionally some small variation between karate schools, most of the kata taught today have not changed for a century or more.

A karate kata is not an exercise in creative problem solving. It is not an opportunity to demonstrate a novel or inventive solution to a threat. It is a set sequence of moves from which there must be no deviation. None. Simply put, a kata is either correct or incorrect.

The value of a traditional karate kata lies inherently in the repetitive way one learns it. In a real-life scenario, where a karateka is attacked, their body will move to defend and counter without thought. This is a result of muscle-memory and a comprehensive understanding of the moves used in a kata and their meanings.

However, in the context of computer programming, the term kata is typically used to refer to a logical or mathematical problem, and a solution to said problem. Kata are frequently used to show-off flashy, complicated, or inelegant solutions — often riddled with decipherable regular expressions, and unwieldy nested loops. There is no strictly defined, right or wrong, implementation of a code kata. On Codewars the countless different solutions are upvoted and downvoted. In short, I think that the term kata, as used in this context, is inaccurate. I would advocate for the use of the, admittedly less exciting, terms ‘challenge’, or ‘problem’.

Now on to the more complicated and, undoubtedly more important, question of the effectiveness of code kata as a means of practise and self-improvement for software crafters. Code kata make a great deal of sense to me as a tool for familiarising oneself with a new programming language, technology, or text editor but, while I see great value in solving an interesting and challenging problem, I see far less value in then repeating this solution over and over, ad infinitum. When a karateka practises the same sequence of moves repeatedly they are training their body and their mind —their stamina and their fitness is improving, their muscles are becoming stronger, their breathing more coordinated, their movements faster, more fluid, more coherent, and more instinctive. After a software crafter has solved a programming problem once, their repeating the solution will not yield improvements in the same fashion. There is no change, no progression, only an increase in the speed of implementing the solution from start to finish.

In closing, I’ll say only that I am proud to call myself an Apprentice Software Crafter and am a firm believer in the philosophy of Software Craftsmanship, but I remain sceptical about the accuracy and efficacy of code kata.

--

--

Michael Jacobson

Amateur photographer and mechanic. Professional software engineer.