Lately, I’ve talked about book clubs and code katas. While talking about code katas, I said:

For a long time, I thought that code katas were puzzles that people solved together. I’ll describe a few of those exercises in another article. Group coding exercises are fun but have different goals.

This post explores group coding exercises.

Code Dojo

Group Coding versus a Kata

Katas are about refining technique through repetition. Group coding exercises offer no repetition. Once the objective is reached, few participants revisit the problem, certainly not over and over. And, a group coding exercise is not about refining a technique. The act of refining implies the removal of impurities or to improve distinctiveness or accuracy.

If not these things, what is the value in a group coding exercise?

Dojo

The word dojo simply means “room” or “hall”. In taekwondo, we call it a do-jang. It’s a place we get together with fellow martial artists and practice. Some of us are white belts, some are colored belts, and some are black belts.

There’s this idea in a do-jang that we will all practice to our abilities and we will each learn lessons appropriate to our rank. White belts get to see where taekwondo can lead them. Many won’t like what they see and they leave and that’s okay. Some find something they like and will choose to stay, and that’s okay too.

Colored belts not only get to see their progression, but many seminal moments in their taekwondo journey will happen in a do-jang. There will be a time where they succeed in performing a kata in front of the class, where they will have the instructor demonstrate a technique for the class. There will also be a time where they slip and fall in front of the class, when they misstep and hurt a classmate a little while sparring. Both kinds of experiences are crucial to growth, and a good do-jang offers them in spades.

People learn best when their chances of success and failure are about the same. Conditions where you succeed a lot tend to be monotonous, ultimately leading to hubris and stagnation. Conditions where you fail often are perplexing, infuriating, then discouraging – maybe to the point of apathy – as nothing you try yields the results you want.

Black belts in a do-jang get hands-on experience in teaching others. As teachers have known for a long time, one of the best ways to learn something is to teach it to someone else. Gaps in knowledge get exposed, and it can be unnerving to people who have risen through the ranks. This need to teach lower ranks can cause the most coordinated black belt to despair, because physical and mental strength is no longer enough. A good black belt has social strength and a sturdy character, which is something that can’t be taught but can be grown.

At the same time, black belts are still students. They are exposed to a wider variety of material than they ever were in colored belt ranks. Some find this overwhelming. My teacher, Ms. Moormeier, often used to say that to her, getting a first degree black belt was like graduating high school, and that once you earn your black belt, you know the basics and the real learning can begin.

Code Dojo

Group coding exercises are also known as code dojos. A code dojo is meant to be a safe place to try new programming ideas. Where a code kata is a place to hone skills, a code dojo is a place to learn new skills from each other.

As with a code kata, a code dojo starts with a group of programmers and a problem to solve. Like a code kata, the problem is usually simple but not trivial to solve. Unlike a code kata, it often takes longer to solve. Often, it has nothing to do with the daily work, because it’s valuable to spend time [barking up the wrong tree] (http://www.bakadesuyo.com/what-does-it-take-to-become-an-expert-at-anyt) on the way to expertise.

In a code dojo, the group codes up different solutions to the same problem. Sometimes, the people take turns in front of a projector working on an implementation. Other times, they go off on their own or in pairs and work on a solution. In my groups, people often use different languages, but the group may decide to all use one programming language.

The important part comes afterward. The group come back together and discusses the problem and the presented implementations. As each person presents, the group talks about each solution’s relative merits. Inevitably, people find an approach fascinating. Sometimes, it’s because it’s an approach that have never seen or wouldn’t have thought of. Other times, it’s because someone took the same approach and there are deep similarities between that solution and their own.

White belt programmers get validation that they do indeed know how to code something. They also learn how more experienced programmers deal with criticism and debate about their creations. Colored belt programmers get exposed to a variety of techniques and their career begins to branch out in unexpected and fruitful ways. Black belt programmers learn to mentor other programmers.

The Value of Repetition

While it’s true that a group doesn’t often repeat the same exercise over and over, I have found it instructive to try the same problem more than once with different techniques.

For example, I’ve tried the Secret Santa problem in PowerShell, C#, and F#. The F# post describes the different in approaches each time. It’s true, there is no single solution to a computing problem!

Feedback

Have you participated in a code dojo? What has worked for you? What hasn’t? What’s your favorite group coding exercise?