Agile Pair Programming – Pros and Cons of Pair Swapping

agilepair-programming

The general idea that is espoused by most Agile / XP theorists seems to be that pairs should swap regularly. For example each programmer should swap pairs once per day; half the people swap at the start of the day, half the people swap after lunch: due to external factors such as meetings, holidays and the like most people will tend to flip their swap times once or twice per week so that the pair configurations distribute fairly evenly across the team.

One rationale behind frequent swapping is that knowledge is spread amongst the team quickly and evenly, rather than having specific skills and knowledge being concentrated in particular individuals – implying that work can continue smoothly if people are either away or leave the company. Another rationale, which is a sort of corollary to the dogma surrounding pair programming itself, is that each time someone swaps on you are getting a new code review by a fresh pair of eyes, so it can only improve code quality.

Both assertions sound reasonable; from a management point of view it sounds like you get an increase in both stability and quality, and as such frequent swapping is pretty much standard theory in most Agile / XP books that I've looked at.

So, when actually put into practice, what do people actually think about pair swapping from

  • A programmer's point of view?
  • A manager's point of view?

And

  • What should determine when someone swaps off of / onto a pair?

Best Answer

Pair Programming is difficult.

It's difficult because it works best when the 2 people involved are close in skill level and that can be difficult in some work environments. It can be more difficult when you swap out because you need to find someone else with the appropriate skill level and then bring them up to speed on the current problem. The benefit is more people have exposure to any given piece of code that has been paired on. This should lead fewer times where code can't get fixed because no one knows enough about it. It should also propagate group ownership and the ability for anyone to pick up any piece of work.

I have found that even in environments where pairing is done, pair swapping is not worth the cost. However, this may be due to our tasks never taking more than ~1.5 days. We found a great benefit to breaking tasks down to be no bigger than ~1.5 days worth of work. Pair swapping may make more sense in the context of longer running tasks.