Pair programming

From Wikipedia, the free encyclopedia

Pair programming requires two software engineers to participate in a combined development effort at one workstation. Each member performs the action the other is not currently doing: While one types in unit tests the other thinks about the class that will satisfy the test, for example.

The person who is doing the typing is known as the driver while the person who is guiding is known as the navigator. It is often suggested for the two partners to switch roles at least every half-hour or after a unit test is made.

Contents

[edit] Benefits

Pair programming is touted to yield the following benefits, roughly ordered from largest benefit to smallest:

  • Increased discipline. Pairing partners are more likely to "do the right thing" and are less likely to take long breaks.
  • Better code. Pairing partners are less likely to produce a bad design due to their immersion, and tend to come up with higher quality designs.
  • Resilient flow. Pairing leads to a different kind of flow than programming alone, but it does lead to flow. Pairing flow happens more quickly: one programmer asks the other, "What were we working on?" Pairing flow is also more resilient to interruptions: one programmer deals with the interruption while the other keeps working.
  • Multiple developers contributing to design. If pairs are rotated frequently, several people will be involved in developing a particular feature. This can help create better solutions, particularly when a pair gets stuck on a particularly tricky problem
  • Improved morale. Pair programming can be more enjoyable for some engineers than programming alone.
  • Collective code ownership. When everyone on a project is pair programming, and pairs rotate frequently, everybody gains a working knowledge of the entire codebase.
  • Mentoring. Everyone, even junior programmers, possess knowledge that others don't. Pair programming is a painless way of spreading that knowledge.
  • Team cohesion. People get to know each other more quickly when pair programming. Pair programming may encourage team gelling.
  • Fewer interruptions. People are more reluctant to interrupt a pair than they are to interrupt someone working alone.
  • One fewer workstation required. Since two people use one workstation, one fewer workstation is required, and therefore the extra workstation can be used for other purposes.

Studies have shown that after training for the "people skills" involved, two programmers are more than twice as productive as one for a given task. According to The Economist,

"Laurie Williams of the University of Utah in Salt Lake City has shown that paired programmers are only 15% slower than two independent individual programmers, but produce 15% fewer bugs. Since testing and debugging are often many times more costly than initial programming, this is an impressive result." [1]
(Dr. Williams is currently Assistant Professor of Computer Science at North Carolina State University)

The Williams et al. 2000 study showed an improvement in correctness of around 15% and 20 to 40% decrease in time, but between a 15 and 60% increase in effort. Williams et al. 2000 also cites an earlier study (Nosek 1998) which also had a 40% decrease in time for a 60% increase in effort.

A larger recent study (Arisholm et al. 2007) had 48% increase in correctness for complex systems, but no signficant difference in time, whilst simple systems had 20% decrease in time, but no significant difference in correctness. Overall there was no general reduction in time or increase in correctness, but an overall 84% increase in effort.

Another recent study presents a rigorous scientific experiment in which novice–novice pairs against novice solos are much more productive than expert–expert pairs against expert solos, according to "Int J. of Human Computer Studies Vol (64) 2006"

[edit] Criticisms

  • Experienced developers may find it tedious to tutor a less experienced developer in a paired environment.
  • Many engineers prefer to work alone, and may find the paired environment cumbersome.
  • Productivity gains or losses are hard to compare between paired and non-paired environments, as metrics of programmer productivity are controversial at best.
  • Differences in coding style may result in conflict.
  • In the case where the team has slightly different work schedules, which is common in an environment that values work-life balance, the pair is only available during the overlap of their schedules. Therefore, not only does it require more man-hours to complete a task, a typical day has less pair-hours available, which further increases the overall task completion time.
  • Where a company values Telecommuting (working from home) or when an employee must work from outside the office for whatever reasons, pair programming can be difficult and even impossible.

[edit] See also

[edit] External links