What is pair programming?

Pair programming is an agile software development technique in which two programmers work together at one workstation. One, the driver, writes code while the other, the observer or navigator, reviews each line of code as it is typed in.

If you talk to any good agile team, they should be able to spit back this definition, and explain the benefits of pairing in their daily work.

The main two positions

Pair programming focuses on two positions, the ‘driver’ and the ‘navigator’. When used with two experienced developers who are comfortable switching between being a ‘driver’ and ‘navigator’, the code quality and development experience are wonderful.

Navigators tend to focus on the overall direction and style of the code, while drivers focus on the implementation.

I believe that pairing is beneficial when attempting to solve complex problems, and helps to get programmers talking about design ideas that they may not have considered by themselves.

The hidden position

There is a third position that occasionally occurs when pairing that I’ve called the ‘passenger’.

The passenger position appears when a junior developer pairs with a senior developer, and isn’t given a chance to ‘drive’. The junior developer is essentially along for the ride, and will quietly defer all decision making to their partner. This situation benefits no one (the junior won’t learn, and the senior hasn’t considered all possible design choices).

I have been in this situation, and have a solution for all junior developers going through when pairing.

Ask To Drive!

Politely asking your senior partner to be your navigator is the best way to learn something new while keeping the pairing system intact. The progress that you make on a problem will decrease, but you will gain a better understanding of what is being built, and your senior partner will be forced to explain their design recommendations in greater detail.

Happy pairing!