“Whatever luck I had, I made. I was never a natural athlete, but I paid my dues in sweat and concentration and took the time necessary to learn Karate and become World Champion.” – Chuck Norris (American martial artist and actor. Also, the only man who has counted to infinity. Twice.)
Japanese concepts from martial arts become common practices in software craftsmanship. It is known that thousands of software developers aiming to become craftsmen are mastering their skills using them.
In fact, in the software industry developers are taught the theory and thrown straight into working on a project. The practice is done on the job, and mistakes occur. Applying the theory is not enough, greatness comes from practising. What makes a programmer to be great is the practice done beyond the software development current job. That’s why so many developers nowadays practice Code Kata.
Why would you do Code Kata?
In karate a kata is an exercise where you repeat a form many times, making small improvements each time. The intent behind code kata is similar. Each iteration is a short exercise (about 30′ to 1-hour duration). The point of the kata is not arriving at the right solution, but to learn some stuff along the way. The only goal is to practice.
Exercise your programming muscles in a way you enjoy and see the progress you make.
What is Code Kata?
A code kata is an exercise in programming which helps a programmer improve their skills through practice and repetition. The term is considered to be coined by Dave Thomas, co-author of the book The Pragmatic Programmer: From Journeyman to Master, in a bow to the Japanese concept of kata in the martial arts.
An example of Kata
Repeat solving the same problem (as the one below), until you know it by heart. You can be sure the next time it pops-up in production it will take you seconds to get it done.
Think of binary numbers: sequences of 0’s and 1’s. How many n-digit binary numbers are there that don’t have two adjacent 1 bits? For example, for three-digit numbers, five of the possible eight combinations meet the criteria: 000, 001, 010, 011, 100, 101, 110, 111. What is the number for sequences of length 4, 5, 10, n? Having worked out the pattern, there’s a second part to the question: can you prove why that relationship exists?
Leave a Reply