Code Katas: Can They Make You A Better Developer?

Code Katas: Can They Make You A Better Developer?

by | 4 min read
Published:
Updated:

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.

🚀 Are you looking to level up your engineering career?

You might like my free weekly newsletter, The Curious Engineer, where I give career advice and tackle complex engineering topics.

📨 Don't miss out on this week's issue

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.


🙏 Was this helpful? If you want to say thanks, I love coffee ☕️ , any support is appreciated.


ALSO ON ALEXHYETT.COM

Knowledge Management for Software Developers

Knowledge Management for Software Developers

  • 02 June 2023
As developers there is so much information that we need to retain in order to be able to do our jobs. There is the general programming…
Why You Struggle to Learn to Code

Why You Struggle to Learn to Code

  • 20 January 2023
Learning to code is easy, until it’s not. When you first start learning how to code, you are learning the syntax and some of the basic…
15 Best Books for Programmers You Should Read

15 Best Books for Programmers You Should Read

  • 19 January 2023
As software developers we constantly need to learn new concepts, programming languages and technologies to stay up to date. One of my…
How I Take (and Organise) My Notes As a Software Engineer

How I Take (and Organise) My Notes As a Software Engineer

  • 05 January 2023
Taking notes is incredibly important as a software developer or for any career for that matter, our brains just aren’t designed for…
Why can’t all programming books look like this?

Why can’t all programming books look like this?

  • 12 January 2016
I have read quite a lot of programming books over the years. A lot of them have been really useful in learning a new programming language…
The Big List of Free Pluralsight Courses for Developers

The Big List of Free Pluralsight Courses for Developers

  • 09 October 2015
One of the most important aspects of being a software developer is the ability to learn new skills quickly. Our industry is moving so…