Following on from our adoption of the mob programming technique, we’ve been keeping our skills sharp by gathering the entire team in the Made Code Dojo (aka the meeting room) every fortnight and doing some kung fu.
Mob programming sessions see us dive into our codebase and pull something out that needs refactoring, and it has been a useful tool for us in the sense that we can go back to old code with the benefit of hindsight and apply lessons we’ve learned in the time since it was originally written.
However, refactoring code within a large Rails application (as most of our projects are) becomes problematic when it comes to testing our changes, as actually running the test suite is incredibly time consuming, taking huge chunks out of the hour that we’ve allocated for the session.
With that in mind, we typically leave testing aside and the session becomes a discussion of other best practice techniques, which whoever is currently piloting the keyboard will demonstrate onscreen. The aim of the sessions is to take what is learned from those discussions and apply them in our day to day work. Coming out with production ready code is absolutely not a priority.
Enter the Dojo
Whilst looking into mob programming and how best to run those sessions, I discovered what are known as “code katas”:
“A code kata is an exercise in programming which helps a programmer hone their skills through practice and repetition.”
This idea of honing our skills with a programming exercise outside of the context of existing work sounded very appealing, and I then discovered the notion of code dojos, where a group of people would band together to come up with the best solution to a given kata. I was especially fond of the way the London Python Code Dojo ran their dojo, particularly their Team Dojo approach and the dev bait (free beer and pizza), as it encouraged a more playful atmosphere.
How We Do Kung Fu
The format we use for the sessions is much the same as the one we use for mob programming:
- We have a limit of one hour regardless of the task
- We divide that hour evenly between each team member present
- Each team member spends his or her time at the keyboard writing code that is displayed for all to see on a large screen
Where Code Dojos differ are that we focus specifically on good TDD first, and that we actually attempt to produce something that works by the end of that hour. I really wanted to incorporate the dev bait idea too, but since our Code Dojos happen early on a Wednesday and drinking in the morning is generally frowned upon, we have pastries in place of beer and pizza.
I’ll usually select two or three katas from one of the many lists of exercises out there, and present them to the group to vote on which one we do that week. The resources below all have plenty of decent katas worth tackling:
- Project Euler
- Coding Dojo
- And we can't forget about Uncle Bob, who has a couple of meaty katas to sink your teeth into.
Previous Code Dojos at Made have seen us trying to do maths with Roman numerals, testing for pangrams and palindromes, and playing Rock, Paper, Scissors, Lizard, Spock against the computer. We’re not always successful – sometimes we’ve simply bitten off more than we can chew within the hour, or we’ve gone on a refactoring rampage after having actually produced something that works and not quite tidied everything up, and it’s not unusual for us to get caught up in a debate about the best way tackle a particular problem.
What we’ve found, after a few months of running the Made Code Dojo, is that the sessions are an entertaining way to share skills with the other people on the team: it helps the more experienced members keep their skills sharp and consider alternative points of view, whilst the less experienced have the opportunity to get stuck in and learn very quickly as the solution to the kata unfolds before their eyes over the course of the hour. Also everyone likes pastries.