A good question, why you need Katas to be a better programmer. I won’t answer this question fully but I try to explain why Katas are good and why you should do them if you can.
The term Code Kata was introduced by Dave Thomas and he is right: if you want to become something better, you should exercise as musicians and sportsmen/sportswomen do.
As a programmer you should do your work-out too, almost every day, in your free time. This helps you to get better. This is why I write articles, do the Variations, and practice. OK, I do my job as a software developer but it is not enough, I have an urge to do something to have less mistakes at work. Less mistakes equal with more robust code and more free time to practice or do anything else.
In the last 16 month I’ve lead a team of developers on a project (and previously I’ve had some responsibilities for developers too as a know-how bearer) and I saw them work and saw their work. It was not the best piece of code. Honestly sometimes it was a piece of crap. And this is because they do not have much experience. As a novice you come from the university or college, have some theory in your back-pack and think everything works as they thought you. But it is different. You have ideas, want to use them — but you’ve never ever practiced them.
As an example one of my team members started to work with us. Fresh from college (just right before the bachelor degree in CS — but with a masters in maths) he told me we should use Scala because Scala is beautiful and easy to develop. I asked him: did you ever work with Scala? The answer was no. And with ideas you cannot build a castle. OK you can but it won’t last long.
So practice. Because at college or university you do not learn how to work — you’re learned how to learn quick and forget everything for new stuff. The same workmate had quite problems with debugging Java code.
But back to the main topic: Katas. You practice and you will probably get better. As in karate, Katas try to teach you the moves with a perfect flow of moves — which does not exist in real life. After a while you can do kumite — practicing with other students, where you learn how to use your moves in real life. And in programming this is a good way too. Pair Programming with another workmate you can gain experience at work.
The downside of pair programming is that you plan a bit overhead what the management mostly do not accept — however paired code is done faster and has less errors (as I saw in my working practice).
How to Kata?
Take your time. Take your piece of code. And experiment.
There are a lot of sites where you can find exercises for Katas. For example Agile Katas where you get a project with iterations and you can implement a small application as a result. However if you are done you can tweak your code, try other approaches — and practice. For algorithmic code you could create a simple load test and measure the performance from your versions.
And that was it. And after some Katas you will see your improvement in your daily work — with your kumite 🙂