Jump to main content

Katas

This post is more than 7 years old. It may be out of date — read and use with care.

If you want to take your skills to the next level, it’s time to start doing some Code Katas. No, it’s not some secret code or a new programming language. It’s a simple but effective way to practice your coding skills, just like a musician practices scales or a athlete practices their form.

The Problem with Everyday Work

We all know the drill: we’ve got to ship new features, fix bugs, and get things done. That’s the life of a programmer. But while you can certainly learn a lot from everyday work, it’s not the best environment for learning and self-development. There’s just no time for trying new things and failing by intention.

The Solution: Code Katas

So, what do you do if you want to grow as a coder? Create an environment where failure is allowed. Sure, starting a side project or open-source project is a step in the right direction. But finding the right task to practice on can be a challenge. That’s where Code Katas come in.

Kata is a Japanese word (型 or 形) meaning "form". It refers to a detailed choreographed pattern of martial arts movements made to be practised alone.

Wikipedia.org

A Code Kata is simply a well-defined, small task that you solve through programming. The time to solve a Kata should be reasonable, so you can get started quickly and see results fast. But the real goal is to practice your skills, not to produce a final product. You set yourself a time limit, like 1 hour, and stop precisely when that limit is reached. You might even throw away the code later. The important part is to reflect on what you did: how did you approach the problem? What worked well? What didn’t work? Get feedback from another developer or work in pairs to learn from each other. And then, start over from scratch. Do the same Kata again, try a different approach, or try the same approach with what you learned from the first iteration.

The Benefits of Code Katas

Code Katas are the perfect way to try something new, let off steam, and practice your skills. Maybe you’ll try a purely test-driven approach this time. Maybe you’ll think about an OO model upfront next time. The possibilities are endless. And one of the most famous Code Katas is the Bowling Game Kata by Robert C. Martin. It’s a simple task to implement the rules of bowling, but it’s a great way to visualize the methodology of Test Driven Development.

Of course, they can’t replace real-world practices or working on your own code. But they offer a quick way to practice your craft and reflect on different approaches to problems. It also serves as an easy tool to get into flow - I sometimes set 15 minute sessions up before I dive into complex code, and until now it served me well.