One of the key aspects of a Software Craftsmanship is constant practice.
Kata (from Martial Arts) is one form of such practice. The notion of a Code Kata was first introduced by Dave Thomas and can be viewed as:
- Practice of the same methods, solutions and activities to a perfection.
- Practice of the same problem, tackling it each time from a different angle or with a different solution.
Solving a known problem multiple times utilizing the same methods, enhances the understanding of the specific steps; It especially enhances the understanding of unit tests, refactoring steps or "Design" approaches. Moreover, striving to do better each time motivates one to learn the keyboard shortcuts and IDE commands in order to perform smoothly. Knowing the tools of the trade (or the tools of the Martial Arts 🙂 ) is essential for the Software Craftsman's success.
Solving a problem in different methods helps to identify solutions that work better in the right context (requirements).
Below (also here) is one of my Prime Factors Kata's sessions recorded late at night :).
The Kata demonstrates finding a number's prime factors using TDD (C#, NUnit, VS 2008).
(Don't forget to turn on the speakers)
I must admit, that it is super difficult to record a completely clean demonstration, especially while synchronizing the music and the moves.
Moreover, one of the real obstacles is statically typed languages (C#) that slow a bit the moves. Exercising the Kata with dynamically typed languages can ease and speed the performance.