A code kata is a small programming exercise rewritten repeatedly to build muscle memory and practice the craft. Borrowing the idea of a martial-arts choreography, it makes repetition a way to notice choices rather than merely reach a finished program. section 8.4.2
The point is not to preserve the first solution. Try a small problem, explore a design, then discard the result and begin again. Rewriting can expose alternatives that were invisible when the goal was simply to make the code work. section 8.4.2
A useful kata habit can be deliberately small:
- Choose an isolated exercise or a narrowly bounded feature. section 8.4.2
- Implement it with a test-first approach when that suits the exercise. section 8.4.2
- Revert or throw away the attempt, then try a different starting point or design. section 8.4.2
- Compare the options explored instead of treating the retained version as the only lesson. section 8.4.2
The bowling-game kata
After learning bowling’s scoring rules, implement a scoring program test first. A first attempt might begin with a Game class, Player, or ScoreCalculator, and might consider inheritance for spares and strikes. If the design becomes messy, reset it. The restart is part of the exercise: it tests whether a different decomposition makes the rules easier to express. section 8.4.2
Katas are often detached from day-to-day work and may train syntax or algorithms on online platforms. They can also become a fast ideation tool for production work: isolate a piece of the current project, practice it with colleagues, and see whether its real constraints produce more relevant learning than a traditional puzzle. section 8.4.2 section 8.5
