What are code katas?
Code katas are programming exercises which, like katas in martial arts, use practice and repetition to improve your skills.
Common katas are Fizzbuzz, the Bowling score calculator, and the Gilded Rose.
Each gives you the criteria of what the kata should do before it can be considered complete along with any specific information, and some websites will also give you a suite of failing tests to make pass - though I prefer to write my own and follow a test-driven development approach.
Once you have completed the solution and the criteria is satisfied, the kata is complete.
Why I do code katas
As I said, doing code katas improves your skills by solving problems and identifying patterns that you may see when working in your project code.
Different katas focus on different patterns. For example, the Fibonacci Number kata focuses on recursion, whereas the Gilded Rose kata is all about refactoring complex legacy code.
Doing code katas keeps your skills sharp and gives you a different perspectives as you work through different katas. You can then use and apply these within your main projects.
If you want to learn a new programming language then working on a kata that you’ve already solved in a language that you’re familiar with allows you to focus on the syntax and features of the new language. I’ve been working on some code katas in TypeScript as I’ve been working with that recently, and would like to do some in Go.
If you work as part of a team or a part of a meetup, code katas can be worked on as a group and can introduce new skills like automated testing and test-driven development as well as providing some opportunities for team-building and socialising. If you’re trying to introduce pair or mob programming, then working on code katas could be a good first step.
If you’re just getting started with programming, working on code katas will help you learn the fundamentals and problem solving, but I’d also encourage you to put the code on GitHub and blog about each kata that you complete. Doing so will help and encourage others and also look good when applying for roles.
P.S. There are lists of code katas at https://github.com/gamontal/awesome-katas and https://codingdojo.org/kata, and online versions at https://www.codewars.com/join and https://exercism.org/tracks. There are many others - if you have a favourite, reply to this email and let me know.
I have some GitHub repositories for my code kata solutions and will continue to build these as I do more.