Dedicated to Agile Methods, Software Craftsmanship and IT Management.

Code Randori - Part 1

In addition to our traditional retrospectives at the end of each iteration, we also hold regular code reviews (Matt posted some details on our Code Reviews here). Generally the format is that we look at our code metrics and pick one to focus on. We might choose to look at methods with a high cyclomatic complexity or JDepend distance metric.

We find the worst offenders and discuss ways to refactor out the underlying problems. But last week we tried something new - a Code Randori. Taking a page from Agile Finland, we based our Randori on their Coding Dojo Rules.

The problem that we tried to code our way around was scoring a Ten Pin Bowling Game. In three iterations of 25 minutes each, we had the concept of a player’s score being the calculated sum of 10 or less frames where each frame had one or two throws and we also built the concept of a spare (we did not quite get to the strike before the final bell rang). Still on the to-do list was the tenth frame peculiarity where strikes and spares do not end the frame and a player can have up to three throws.

We followed Uncle Bob’s TheThreeRulesOfTDD. We allocated an additional ten minutes at the end to run a quick retrospective on the activity. As a result of rigorous TDD, the whole program was never run but every line of code was executed and tested many times. We had 100% test coverage and the product was meeting every requirement that we had tackled. The exercise was fun. We had unexpected participants from the systems and support teams.

This exercise definitely held value for the business. Not in the code that we produced, but in the process that we used to produce it. A couple of the people in the room had never been exposed to such strict TDD and that is clearly something that I would like to see everyone understand more fully. It seems likely that the second, third and fourth of these Randoris will have diminishing value for the business.

So eventually, the Code Randoris will boil down to practice. Wiser people than myself have said that practice is not something that you do at work [1]. I am feeling a little conflicted over this. I see the point, but this "practice" went beyond self-improvement to team improvement. I guess this means it was not practice - it was more like a training session.

In any case, general consensus was that people really liked the Randori. I asked if people liked it enough to do it again after hours – and still the answer was yes. So I expect that we will be holding more Randoris, but we will eventually move them after hours or to weekends.

Afterthought

Since I first wrote this we scheduled a followup and the results were even more interesting. More on that in another post.

Footnote

[1] RT @UncleBobMartin - The way you get better is to practice... And work is NOT practice. Practice has no consequence other than self improvement. – March 6, 2009