Code Sparring: a fun way to practice programming

December 14, 2009

Last week, the Swedish ALT.NET group hosted an experimental Code Sparring night at the RemoteX offices. The idea came from the experiences we’ve had with coding dojos and the problems we recognized with that particular way of evolving as a coder. Mainly we felt that there was too much idle time for the people not sitting at the computer, and things quickly became messy with complex communication behaviors disturbing the overall experience. So I suggested that we should work on programming challenges in pairs instead.

Sparring in martial arts

There are many metaphors for software development taken from the world of hurting other people, and this is no different. I have some limited martial arts experience, mainly MMA, and I’ve always found that the most rewarding part of practice was the sparring.

Technique drilling

A sparring session usually consists of people pairing up to try out their skills in a slightly more realistic environment that is still safe. The sparring may be very broad, i.e. everything is allowed, or sometimes only a subset of techniques can be utilized or you have to accomplish a specific goal (such as a rear naked choke).

A boxing class, for example, might start off with warm-ups and then move on to technical drills, such as a improving hand-eye coordination, like the guy to the left, or specific striking combination for 30 minutes. After that, you could finish with 30 minutes of sparring. The sparring is usually done in pairs, and you go at it for a round and then change your sparring partner. The goal is of course to improve and during the rounds you learn from each other, help each other and get to apply fine-grained knowledge in a complex and fluid situation.

How well does it translate to our profession?

Very well if you ask me. We can say that learning the programming basics through reading books, attending courses, practicing katas etc. is like drilling, and our day jobs are like a real fight in front of an audience. So code sparring should be something in between that is safe (e.g. you wont harm any important production code) and less competitive/dangerous.

I know that Micah Martin has a different definition of what code sparring is, but that was a sort of competition instead of what I feel sparring really is. I’m not saying that it’s a bad thing, but I’d call his version “light contact coding” or something.

Anyway, to emulate real programming work more than a dojo did for us, roughly 10 people gathered at a big table and paired up. In order to keep things fluent, fun and to learn to know each other better, we rotated every 20 minutes. Due to the fact that people might feel uneasy about the prospect of handing over their sacred computer to others, the ones who brought laptops stayed put, and the others switched seats by moving one step to the left. The assignment we chose to work on was the KataYahtzee, driving the implementation out using test-driven development.

SparringThis was a very pleasant experience, far more enjoyable to me compared to a coding dojo, and the rest of the attendees seemed to agree. Before we knew it, the time was 10pm and we had to go home.

The people who rotated always had fresh and clever ideas from the other pairing stations they had been at (just like consultants, eh?) which merged together with the existing code to evolve into something new. And constantly being part of a pair meant that everybody seemed to be focused and utilizing the time efficiently from start to finish. Also, unlike a dojo, any group size should work for this kind of exercise.

The constant change of pairs also meant you had to be able to quickly communicate the whats and the hows of the code to your new partner, which sharpens your verbal skills as well.

The biggest problem that I could see was the strict division between the laptop owners and the more consultant-like people who changed code base every 20 minutes. Some people were not content with sitting in the same seat all night, so there’s room for improvement. Make sure to read Morten Nielsens summary of the sparring as well.

Why don’t you try a code sparring night in your office or with your local user group? If you do, tell me how it went and any suggestions you have for making this better.

EDIT: I am in no way claiming that I invented this kind of practice. I know that CodeRetreats are very similar and other kinds of pairing roulettes existed before I suggested Code Sparring.

About these ads

5 Responses to “Code Sparring: a fun way to practice programming”


  1. [...] Code Sparring: a fun way to practice programming Last week, the Swedish ALT.NET group hosted an experimental Code Sparring night at the RemoteX offices. The idea came [...] [...]

  2. theaveragepoet Says:

    Interesting article! I like the comparison between real sparring with programming lol

  3. ak Says:

    So what exactly did the exercises consist of? I get that you paired up, switched off… But what was the set up? What are the puzzles/tasks that programmer’s have to meet? Does their partner create the challenge?


  4. [...] http://microserf.wordpress.com/2009/12/14/code-sparring-a-fun-way-to-practice-programming/ var addthis_pub = ''; var addthis_language = 'en';var addthis_options = 'email, favorites, digg, delicious, myspace, google, facebook, reddit, live, more'; Tags: Alt.Net Comments (0) Trackbacks (0) Leave a comment Trackback [...]

  5. microserf Says:

    ak: Like I wrote in the blog post, we worked on a code kata called KataYahtzee. Click on the link above to find out more about it.

    But there are no musts. If you have a piece of legacy code that you’d like to experiment on, by all means, go ahead. The sky’s the limit.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: