
Pair Programming
Pair Programming is the XP practice of two people writing code together at one machine, producing one running system. Erich Gamma, writing the second edition’s foreword, names it as one of the practices he and Beck worked in directly, on JUnit among other things.
The evidence, stated honestly
Pairing is the XP practice most often argued about with anecdotes, and it is also the one with a genuine meta-analysis behind it. Hannay, Dybå, Arisholm and Sjøberg pooled the controlled experiments in 2009 and reported three effects, which do not point the same way:
- a small positive effect on quality
- a medium positive effect on duration, meaning the pair finishes sooner in elapsed time
- a medium negative effect on effort, meaning it costs more person-hours
They also report significant variance between studies and signs of publication bias, and a context split: pairing was faster on low-complexity tasks and produced higher-quality solutions on high-complexity ones.
That is a defensible case for pairing on the hard parts and a poor case for mandating it on everything. Anyone quoting the meta-analysis as proof that pairing is free has read one of the three effects. The honest summary is that you buy quality and calendar time with person-hours, and the exchange rate depends on how hard the task is.
What it substitutes for
Much of pairing’s value is review that happens now instead of later, knowledge that spreads without a handover document, and the communication bandwidth of two people at one problem. Those are goals, not mechanisms. Reject the shared keyboard and you still owe the team an answer for each of them. Read through intent and mechanism: the intent is continuous review and shared context, the 2004 mechanism is two chairs at one desk.
Signal: pairs rotate, both people can drive, and the team can say which tasks it does not pair on and why.
Sources
- Kent Beck with Cynthia Andres, Extreme Programming Explained: Embrace Change, 2nd edition (Addison-Wesley, 2004): Pair Programming as a primary practice in chapter 7, and Erich Gamma’s forewords to both editions, in the publisher’s free sample.
- Jo E. Hannay, Tore Dybå, Erik Arisholm and Dag I. K. Sjøberg, The effectiveness of pair programming: A meta-analysis, Information and Software Technology 51(7), 2009, pp. 1110-1122. The three effect directions, the heterogeneity and publication-bias caveats, and the task-complexity split are as reported in the paper’s abstract.