agile pairprogramming

Last modified: October 18th, 2013

Pair programming is one of the most powerful engineering practices of agile development. At its most basic level, pair programming is simply the practice of two programmers developing code together on a single computer. Rather than submitting code for periodic peer code reviews, the code is reviewed constantly.  Pairs generally start off with one member acting as pilot, actively typing on the keyboard, while the other member acts as a navigator. The navigator watches the code, looking for possible mistakes or refactoring opportunities.  Both members will discuss what is going on and actively collaborate on how the code is evolving. Either member is empowered to take the keyboard at any time. Highly effective pairs will establish a flow where the keyboard is constantly changing hands, and the level of discussion is at a constant buzz. There are many variations on this theme. Another popular approach is that one member will write the tests and the other will write the code to satisfy the tests. Ideally, a pairing session will last two to three hours. After that, fatigue can set in and it is a good idea to change partners.

There are a few indicators that a pair is not performing well:

  • Disengagement – One of the members physically moves her chair away from the keyboard, or starts working on his email, etc. Sometimes this can be as extreme as one member falling asleep.
  • Watch the Master – Sometimes one member will be more experienced than the other.  There is a temptation to defer to the more senior member, and the less senior will be relegated to observer status. This will often lead to Disengagement.
  • Silence – Pairs cannot work together if they are not talking to each other.
Costs & Benefits of Pair Programming (Laurie Williams and Alistair Cockburn - .pdf)
Pair Programming Guide (Agile Alliance)
Pair Programming Benefits (c2.com)
Pair Programming Illuminated (Laurie Williams and Robert Kessler)