Pair Programming

Supports Pillars:

Collaboration

Dependencies:

Collective Ownership

Definition:

Pair Programming is a disciplined approach to development in which two developers sit in front of a single machine* and share responsibility for programming. At any given time one person will control the keyboard and mouse and will be known as the "Driver" and the other will be known as the "Navigator." The Driver's responsibility is to focus on the mechanics of operating the computer and entering code. The Navigator's responsibility is to think about what needs to be done and where we are going. The two will communicate continually and shift roles frequently, probably every few minutes.

By using this approach, knowledge of the code base becomes more distributed (see Collective Ownership), programming skills are shared, mistakes are reduced, and a greater degree of focus is possible.

Resources:

http://www.extremeprogramming.org/rules/pair.html

Steps to Mastery:

As practitioners become more experienced with Pair Programming, different levels of capability emerge and can be summarized as follows:

  • None: one workstation per developer - little or no consultation between developers

  • Helping: developers unfamiliar with the practice sometimes collaborate in a debug session to understand the code, especially in response to a bug

  • Conferring: one workstation per developer - neighbors consult each other frequently.

  • Watching: one workstation per pair - each member of the pair watches the other solo program

    • Ping-pong pairing: a means of preventing the watching pattern by rigidly following the process of write test, switch drivers, implement, repeat. Especially useful as a teaching or transition method.

  • Skilled: practicing frequent driver/navigator exchanges - sometimes needs reminders/guidance from more experienced team members.

  • Very skilled: a natural, fluid, and frequent exchange of driver/navigator responsibilities.

Other advanced skills include:

  • Pairs rotate 2-4 times per day.

  • Pair rotation follows the first-in-first-out rotation strategy.

  • Pairs rotate naturally several times a day, or swarm around a computer or whiteboard as needed.

  • Pairs protect the train of thought by splitting temporarily when there are interruptions.

Organizational Support of this Skill:

Success at pair programming is much easier with the right physical environment--wide enough workspaces for two people to sit comfortably and easily control the computer (either sliding the mouse/keyboard back and forth, or having a dual setup), the right sound control that other pairs can still be overheard but are not too distracting, accommodation of personal space and breaks.

*Some non-co-located practitioners have had success Pair Programming using virtual network computing (VNC) with voice teleconferencing to allow two developers to "virtually" sit next to each other while sharing one computer desktop.