Code Katas: Can They Make You A Better Developer?
Published: 2022-11-24 12:26:08

---
title: Code Katas: Can They Make You A Better Developer?
published: true
date: 2022-11-21 14:33:18 UTC
tags: 
canonical_url: https://www.alexhyett.com/code-katas-better-developer/
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ede7er25gd6gkhui5fpr.jpg
---

They say “practice makes perfect”, although I much prefer “practice makes improvement”. Either way, how do you practice being a programmer?

If you are already working as a software developer then you will be getting some practice from working on large projects. There is a chance however that you are just repeating what you already know.

There is a quote from Peter Voogd’s book [6 Months to 6 Figures](https://geni.us/RQAGV) that come to mind:

> You often hear people say “I have 20 years of experience, I should get paid more”, but in actuality, that person has 1 year of experience repeated 20 times.

On a day-to-day basis, are you actually learning new skills, or are just repeating the same thing over and over again?

Learning on the job isn’t always the best environment for learning new skills. There is often too much pressure to deliver to be able to take the time needed to learn a new skill. This is where coding katas come in.

## What is meant by code katas?

Code Katas was first coined by Dave Thomas who co-wrote the book [Pragmatic Programmer](https://geni.us/GfNj9) with Andrew Hunt. It is safe to say that Dave knows what he is talking about.

Code Katas gets its name from martial arts where Katas are described as:

> kata /ˈkɑːtɑː/
> 
> a system of individual training exercises in karate and other martial arts.

Kata in martial arts involves practicing particular movements over and over again until you can do them automatically without thinking. A code kata can be thought of in a similar way.

A code kata is a small, self-contained exercise that can be used to practice particular programming techniques such as Test Driven Development (TDD) or Behaviour Driven Development (BDD). They are supposed to be a fun, low-pressure way for you to get some practice outside of work.

## What are the benefits of doing code katas?

Even if you are an experienced programmer doing code katas still has a number of benefits.

Software developers are often working against tight deadlines which isn’t the best time to practice a new skill.

I often hear developers wanting to learn things such as TDD but doing so on the job is time-consuming and they haven’t got any personal projects to try it out on either.

Code Katas often have simple requirements and restrictions which is a perfect scenario for starting to write tests first.

Code katas are a great way of practicing a new skill without the pressure to deliver. You can take as long as you want on them, and if you make a mistake it’s not the end of the world.

Fancy learning a new programming language like Rust or Java? Why not try doing a code kata in that language?

I think that code katas are also a great way of forcing you to use good programming practices such as refactoring, modularity, and ensuring your code is easy to maintain.

## Code Katas Examples

Coding Katas can be similar to exercises you see on LeetCode but with more focus on learning than gamification and competition.

You are free to pick whatever programming language you want to do a code kata, even a new one. If you are trying to improve on a particular language there are a few language-specific examples below as well.

### BDD Katas

If you are looking at practicing behavior-driven development then this BDD coding kata is worth a try:

- [Social Networking Kata](https://monospacedmonologues.com/2013/04/the-social-networking-kata/)

### Refactoring Katas

To get better at refactoring you need an actual project to work on. These examples are from Emily Bache who has lots of coding katas on her GitHub profile to try out.

- [Gilded Rose (multiple languages)](https://github.com/emilybache/GildedRose-Refactoring-Kata)
- [Yatzy (multiple languages)](https://github.com/emilybache/Yatzy-Refactoring-Kata)
- [Tennis (multiple languages)](https://github.com/emilybache/Tennis-Refactoring-Kata)

### SOLID Katas

The SOLID principle can be difficult to get your head around especially, to begin with. Why not try it out with these Katas?

- [Bowling Game Kata](http://www.butunclebob.com/ArticleS.UncleBob.TheBowlingGameKata)
- [Bank Account Kata (Java)](https://github.com/sandromancuso/Bank-kata)

### TDD Katas

You can try out test-driven development with any Code Kata but these are a good place to start.

- [Clock-in Kata (Javascript)](https://github.com/wolframkriesing/clock-in-kata)
- [Christmas Lights Kata (multiple languages)](https://kata-log.rocks/christmas-lights-kata)
- [Mars Rover Katas (Java)](https://technologyconversations.com/2014/10/17/java-tutorial-through-katas-mars-rover/)

### More Coding Katas Examples

Looking for more code kata examples to try? There are some great resources here:

- [Dave Thomas’ Code Kata Website](http://codekata.com/)
- [Gabe Montalvo has a bit list on GitHub](https://github.com/gamontal/awesome-katas)
- [Kata Log](https://kata-log.rocks/)
- [Curated List on HackMd](https://hackmd.io/@pierodibello/A-curated-list-of-programming-kata)
- [Emily Bache has many examples on GitHub](https:/github.com/emilybache?tab=repositories)

### Are Code Katas Worth Doing?

I think CodeKatas can be a great way to improve your programming skills, but they need to be done regularly to get the most benefit from them. No matter what your skill level there are always benefits in practice.

> Practice makes improvement

Have any more great Code Katas examples? Let me know in the comments.