Pair Programming

Pair programming is a practice in which two programmers work together at a single workstation. The Agile Alliance glossary describes it as “two programmers sharing a single workstation (one screen, keyboard, and mouse among the pair).” Martin Fowler likewise describes it as a practice where “all serious code is written by two programmers, typically sitting side-by-side with a single monitor.”

The two developers take distinct but active roles. The Agile Alliance describes the programmer at the keyboard as the “driver,” while the other, “also actively involved in the programming task but focusing more on overall direction,” is the “navigator.” The driver writes code and explains the immediate steps, while the navigator watches for mistakes and thinks about the larger design.

The pair is expected to swap roles frequently, often every few minutes, so neither person becomes a passive observer. Both must stay engaged for the practice to deliver its benefits.

Pair programming is one of the core practices of Extreme Programming, where it serves as a form of continuous code review. Teams adopt it to catch defects as they are written, spread understanding of the code so it does not live in one person’s head, and help less experienced developers learn from more experienced ones.