Simon Willison’s Weblog

Pair Programming

I’ve spent a few hours over the last two days pair programming with Adrian. We’re working on a pretty huge project at the moment, and we’ve just started work on the coding phase, overlapping the design phase. I had tried pair programming a few times before with some success, but this time in particular the benefits of the approach were crystal clear. In total, we’ve defined 4 database tables, a number of functions and a simple class. Working separately we would almost certainly have created more lines of code. However...

  • The code we have produced is free of bugs. That’s a pretty bold claim to make, but every line has been extensively discussed, tested and looked over by two pairs of eyes.
  • The naming conventions for both the Python code and the SQL are consistent and well thought out. We’re both happy with them, we both understand why the names have been chosen and we both know the naming style well enough to continue it throughout the project.
  • The coding style itself is ultra-clean and approved by both of us. We have a preference now for everything from quoting styles to whether or not a docstring should finish in a full-stop (it shouldn’t). We also know enough to keep these standards going for the rest of the project.
  • We learnt stuff from each other. KDE shortcuts, new features in Python 2.3, neat ways of laying out SQL statements, Python functional programming idioms.
  • We started coding, or at least started discussing the code, at the time we had scheduled for the start. There was no procrastination.
  • At no point did either of us check our email or check any blogs. productivity++!
  • We both know the code that we have written inside out and back to front.

Altogether they have been highly productive and successful sessions. Our plan now is to pair program the system core, then work separately on the additional modules that don’t have major dependencies on each other. There are only two of us developers working on the project so pair programming the whole thing isn’t really practical, but the benefits of working together the core modules are obvious.

One last thing: it was a lot of fun!

This is Pair Programming by Simon Willison, posted on 23rd October 2003.

Next: Progressive page updates

Previous: Knoppix

Previously hosted at