The lead on my most recent project, Matt Terry, wrote a blog post on test first this Saturday that tweaked a few thoughts in my head. There is so much to unpack in that particular event he described, so I’m going to write a couple of blog posts and try to give a few different angles their due.
Now about the story he told. It is true, but …. let’s say it diminishes his role in the situation. I’m going to see if I can’t sing the praises of pair programming.
We found a tricky bug in our scheduler. Matt came over to my desk and we decided to pair on the problem. We started by trying to understand the problem. We chatted over the scenario It was essentially a time race condition. Different components need to know new information at different times. When can we inform these serialized and stored objects the world changed? We wrote some notes and modeled a scenario. Then we wrote some tests. We constantly checked in with each other that our assumptions were correct. We made a point to talk out loud about every thought I was thinking as we coded. We made a point to answer and ask questions. Matt was also great at guilting me in to correct action. There wasn’t a thing he said or did, and he’ll probably be a bit mortified to hear about it. He just had to be in earshot when I muttered, “but that should probably be it’s own method,” and then I’d HAVE to fix the code because the alternative is like walking past trash and NOT picking it up. While someone watches you. Social pressures can be a wonderful thing.
The point is, by being there talking through the whole process we were able to quickly understand the problem and work through the solution. We fixed this far more quickly that either one of us could have on our own. In addition, the solution was better because I wasn’t throwing it over the wall to be reviewed. We wrote the best code we could because we knew we were watching.
All in all, I’m looking forward to pairing with him again. I’m bad at it, but it’s a skill and one I’m starting to find more and more enjoyable as I get better and better at it. Believe it or not, development is an inherently social event and pair programming brings this to the forefront. It increases communication by making it visibly essential to everything.