Extreme Programming Practices - Pair Programming
XP programmers write all production code in pairs, two programmers working together at one machine. Pair programming has been shown by several experiments to produce better software at similar or lower cost than programmers working alone.
This is another area of contention in XP. As with Collective Ownership, the concept of not working alone is foreign to many programmers. However, Pair Programming acts as a real-time code review, and it has a distinct peer pressure aspect to it. Programmers are more likely to develop test-first, follow coding standards and refactor their code when there is someone looking over their shoulder!
Research by Dr. Randall W. Jensen published in 1996 while he was working for the U.S. Air Force spoke of two-person (2P) teams. At the time of the report, 2P teams had been in use since 1975. Initially, there was concern that there would be lost productivity owing to having 2 people work on the same problem. However, the study showed productivity improvements of over 150% at the time scale of a month.
Similar research by Laurie Williams at North Carolina State University has indicated that there is a 15% overhead when programming in pairs, i.e. it takes 15% longer to develop the same code as when it is written by individual programmers. However, the 15% overhead is more than made up for by the reduction in defects and the higher overall design quality of the code. Also notice that the overhead is only 15%, as opposed to the expected 50%. This indicates that two programmers working together are indeed working faster than when they are alone.
An interesting facet of Pair Programming is that it is much more intense than working alone. People have reported not being able to pair for more than 6 hours out of the day simply because they are burned out by that time. The work they have done in that 6 hours is of very high quality, however, and their productivity is greater in the longer term than two developers working individually.
For more information about Extreme Programming, visit our Resources page.