Photo courtesy of StockSnap.io taken by Ryan McGuire (CCO License)
A fun way to practice and familiarize yourself with development tools, workflows, patterns and practices.
Wikipedia states that a code kata is an exercise in programming which helps a programmer hone their skills through practice and repetition.
The term was probably first coined by Dave Thomas, co-author of the book The Pragmatic Programmer, in a bow to the Japanese concept of kata in the martial arts.
As of October 2011, Dave Thomas has published 21 different katas.
“I may drive to work every day, but I’m far from a professional driver. Similarly, programming every day may not be enough to make you a professional programmer. So what can turn someone into a professional driver or programmer? What do you do to practice?” ~ Jeff Atwood
To me the idea is not to become better at writing actual code but rather to become more familiar with your development toolbox.
If you are writing production code, and are hindered by your IDE or find yourself grabbing for the mouse to do the same thing over and over again, or are new to a concept then a Code Kata could help you optimize your workflow.
- Familiarize yourself with your tools (IDE, editor, keyboard).
- Experiment with features you don’t usually get time to experiment with.
- Learn a new tool or language.
- Practice a new or alternate work flow, idea or concept like TDD, BDD, patterns, refactoring, naming etc.
- Learn shortcut keys by unplugging your mouse.
- Practice different types of programming techniques or ways to solve the same problem. Try not to use an if statement etc.
- Improve and optimize your speed and efficiency without worrying about the logic behind the problem.
It’s a small, simple and fun exercise that you can do each day or weekly for about 10 to 30 minutes depending on what you want to gain from it and your own personal preference.
- You need to be in a space where you are not interrupted in that time.
- You need to be clear about what you want to strive for or achieve in your sessions.
- Decide how long you want your session and start a timer so that you don’t go over.
Here are some resources to help you get started with Code Katas:
- Code Kata - Explore 21 different code katas by Dave Thomas
- Codewars - Train on katas from their website.
- Uncle Bob’s Bowling Game Kata
CodinGame is a challenge-based training platform for programmers where you can play with the hottest programming topics. Solve games, code AI bots, learn from your peers, have fun.
Project Euler is a series of challenging mathematical/computer programming problems that will require more than just mathematical insights to solve. Although mathematics will help you arrive at elegant and efficient methods, the use of a computer and programming skills will be required to solve most problems.
Codecademy is a platform that allows you to learn new languages in an interactive tutorial based interface so that you don’t have to install anything while you learn.
Jeff Atwood provides some alternate approachs to Code Katas through
The Programmers Stack Exchange community respond to a question titled Drawbacks of Code Kata. Some responses are along the lines of:
- It’s difficult to introduce in a work place
- You must actually try to improve in some sense
- It takes time
- Some people think it isn’t worth the time it takes
- Some people find it boring
- You don’t have a cool working product at the end
In 2014, John Sonmez wrote about his perspective as to why he doesn’t do Code Katas. He makes some interesting points around achieving software development mastery although I don’t think that is the goal of a Code Kata. Regardless, you may be able to extract some useful tips for mastery.