Pragmatic Pair Programming
Pair programming is all the rage these days and for good reason. You get well-tested, well-thought-through code at a dizzying rate without many of the pitfalls of solo programming. Pivotal Labs have been pioneers in this area, showing the industry how it should be done in practice.
The downsides of solo programming are many. It’s far too easy to:
- get hung up for hours on a trivial problem
- write code that’s inconsistent with the rest of the system
- skip writing a unit test here and there
- take shortcuts you’d be too embarrassed to take in front of someone else
- rack up technical debt
- lose motivation
You won’t find pair programmers gazing out the window, surfing Facebook, IM’ing, or shopping on Amazon. They’re focused and pushing each other to write great software. I’ll hire pair programmers over 2 solo programmers any day of the week. The long-term costs of owning and maintaining pair programmed systems are far less than a system developed by a team of solo programmers.
That said, the notion that you should pair on every line of code while sharing one computer is like charging your clients for a backhoe loader with operators when sometimes they only need a guy with a shovel. Wikipedia references pair programming studies that have shown pairing on complex problems yields better quality code with fewer defects in the same number or fewer total developer hours. Right on! If you’ve paired you’ve experienced the magic. But wait, with simpler problems the studies showed pairing yielded the same quality code in double the number of developer hours. Makes sense too, right? Pairing through the simple stuff can be a bit tedious.
Pragmatic pair programming is all about pairing on the complex stuff and then when you hit some easier stuff, parallelizing and soloing on it. For example:
Now that we have the acceptance tests and controller tests in place you work on the validations while I work on the JSON serialization. Then lets come come back together to pair on the business logic.
You still sit together and work together but now you’re working optimally pairing on the complex and parallelizing on the simple. Give it a shot and let me know how it works for you!