cbillowes/curious-programmer-oxygen

View on GitHub
content/posts/2016/2016-08-13-code-katas/index.md

Summary

Maintainability
Test Coverage
---
title:  "Code katas"
cover: "https://picsum.photos/1600/800/?image=532"
date:   2016-08-13 19:44:42 +0200
tags:
    - Productivity
---

> A fun way to practice and familiarize yourself with development tools,
> workflows, patterns and practices.

[Wikipedia](https://en.wikipedia.org/wiki/Kata_(programming))
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](https://blog.codinghorror.com/the-ultimate-code-kata/)

## Benefits

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.

## Getting started

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](http://codekata.com/) - Explore 21 different code katas by
    Dave Thomas
-   [Codewars](https://www.codewars.com) - Train on katas from their website.
-   Uncle Bob's
    [Bowling Game Kata](http://butunclebob.com/ArticleS.UncleBob.TheBowlingGameKata)

## Alternatives

-   [CodinGame](https://www.codingame.com) 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](https://projecteuler.net/)
    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](http://www.codecademy.com/) 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](https://blog.codinghorror.com/the-ultimate-code-kata/)
    to Code Katas through
    -   [practice drills](https://sites.google.com/site/steveyegge2/practicing-programming)
        from Steve Yegge,
    -   general recommendations outlined in [Teach Yourself Programming in
        Ten Years](http://www.norvig.com/21-days.html) by Peter Norvig, and
    -   adds two of his one movements which including writing a blog and actively
        participating in a notable open source project or three.

## Trade-offs

The Programmers Stack Exchange community respond to a question titled [Drawbacks
of Code Kata](http://programmers.stackexchange.com/questions/138479/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](https://hackhands.com/dont-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.