Practice Your Skills with Code Katas
Tags: learning, career, programming
Published: 2024-02-09 14:48:07

A few years ago, I started a weekly code kata at work with a small group of co-workers. My motivation at the time was to help an intern who was struggling with the "real" work. I figured code katas were a good practice. You can try new things, refine what you know, and can't break anything so there is only upside. The intern moved on and this small group of developers still meets every Friday at 10:30. It is the best part of the week, or so I have been told by some.

### CodeWars

The platform I chose for the weekly katas is [CodeWars](https://www.codewars.com). CodeWars is a collection of coding challenges spanning 50+ programming languages. There are thousands of katas, each created by CodeWars members. Each kata gives you a problem description, 2 sets of unit tests, and a difficulty ranking. Your code must pass all the tests. You are provided with an in-browser editor (supports vim motions!) and the build/test process is handled behind the scenes for you. There is literally nothing you have to set up. If you haven't used CodeWars before, give it a try.

### What We Practice

We try to stick to katas with a difficulty rank of 6 but will sometimes attempt a 5 (smaller numbers are harder). We can usually work through those in an hour of less. Examples of katas we have done include "Linked Lists - Front Back Split", "Linked Lists - Shuffle Merge", "Tic Tac Toe Checker", and "Maze Runner" (links below). Some of these are truly straight forward solutions, and some will sound simple when reading the description only to have a surprise in the second set of hidden unit tests. Often times, there are complicated edge cases, or extremely large inputs that will cause the naive solution to timeout.

### How We Practice

I have been asked by some if we are enforcing best practices or a certain coding style, or if we are choosing katas that are directly applicable to the work we do for our job. In general, the answer to these questions is "no." We chose a kata that looks like an interesting problem to solve. We solve it as a group, or we'll break into small groups when more the 5 show up. The working solution usually contains code following some accepted standard or style, but that is never the goal. We occasionally explore parts of the language that are most definitely not a good practice (looking at you JavaScript eval()). Sometimes you have to write bad code to know why it is bad. After completing the kata, we can see the solutions other CodeWars members have submitted. This is often an enlightening experience. You can see how others solved the problem more efficiently or with clearer code, or used some really awful code (I swear, some people use RegEx for every problem, wtf).

### Keep Practicing

This started with the intention to help an intern learn JavaScript and C#. That was three years ago. It has evolved into a fun way to refine our skills without worrying about long term support and maintenance. For some, learning the language is the goal, for others explaining in simple terms why "algorithm A is a better choice than algorithm B in this instance" is the goal. For me, the goal of this is deliberate practice, and getting better by repeated efforts.


These are some katas we have done recently. The last one in the list gave us fits.

- Maze Runner
- Bouncing Balls
- Tic-Tac-Toe Checker
- Linked Lists - Shuffle Merge
- Linked Lists - Front Back Split