Alex Hyett
Alex Hyett

Alex Hyett

Code Katas: Can They Make You A Better Developer?

Code Katas: Can They Make You A Better Developer?

Alex Hyett's photo
Alex Hyett
·Nov 21, 2022·

4 min read

Subscribe to my newsletter and never miss my upcoming articles

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 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 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:

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.

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?

TDD Katas

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

More Coding Katas Examples

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

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.

 
Share this