Robert “Uncle Bob” Martin came to visit SmartyStreets, where I work. This was the third time he’s come to SmartyStreets and each time has been transformative–he knows his stuff and it’s good stuff. If you haven’t begun working through his training videos on cleancoders.com you should avail yourself. His work and material has made a huge impact on code I’ve written since I began following him almost a decade ago.
While he was with us I pair programmed for over 8+ hours over the course of 3 days with a few of my coworkers. This wasn’t just a simple bowling game kata. It took three days of coding to finish the task at hand, which was a scaled down command-line address list processor. We applied TDD mercilessly. We refactored like crazy people. We kept the code clean. We pair-programmed the entire thing. It was a great experience.
In the process I learned something about myself and pair programming. You see, I’ve never actually enjoyed pair programming. I’ve seen it done well, and seen the benefits but I’ve always struggled to apply the discipline for long stretches. It seems to introduce an emotional and social element on top of the technical challenges already inherent to software development and this has proved exhausting.
During our coding sessions Uncle Bob imposed a new discipline for us to apply–the Pomodoro technique, named for the usage of a tomato timer to manage your time spent working. I had seen Uncle Bob apply this technique in his various case study episodes.
The idea of the Pomodoro technique is that you set a timer for 25 minutes and work with extreme focus on the task at hand. When the timer goes off, you leave what you are doing (no matter what state it is in) and take a 5 minute break, rinse and repeat. After four such sessions (ie. “tomatoes”) you take a slightly longer break.
It may seem odd to leave a project for a break even if the tests aren’t passing or the code isn’t even compiling. However, the result of using this technique extensively in the last week is that for the first time I have actually enjoyed pair programming enough for it to come close to being my default way of working.
Now, employing a discipline isn’t just done for its own sake. A helpful discipline will help us solve a problem, or go about solving a problem in a more effective or more efficient way. For example:
You see, when working in a pair, there comes a moment when one or both of the pair programmers would benefit from a break, but there’s a problem: Either we don’t perceive this moment for ourselves or we feel that taking a break would kill the momentum of the pair. Using a simple timer to enforce regular breaks has completely solved this conundrum for me. I use the break time to take a deep breath and get a drink. I step back and see the big picture. I ask for help from other colleagues if my partner and I feel stuck. Consequently, we manage to get unstuck much sooner. Over several “tomatoes” we’ve made more progress with less total energy spent–in short, it’s a more efficient way to work over the long haul.
So, if you’ve struggled with Pair Programming in the past, try imposing a new discipline: the Pomodoro Technique!