Pair Programming – An Extremely Agile Practice

Get insights in your inbox

Pair Programming. It’s probably one of the most extreme practices of eXtreme Programming (XP). It’s an area of agile software development that polarises opinion.

The concept is simple enough. Two developers work side by side on the same piece of work, sharing a keyboard and screen and working together to produce the code.

The main advantage of pair programming is usually cited as improving quality, which also improves productivity further down the line.

Another advantage is spreading knowledge, as at least two people will know each area of the system. And it can also help with skills development – a kind of coaching and mentoring technique with one of the pair more experienced than the other.

It’s also possible to benefit from the theory that two brains are better than one. A simple way of explaining this is that two people have very different experiences. One may see a solution that the other doesn’t. It’s possible that two minds might lead to solutions that are quicker to implement and simpler to maintain.

Even without pair programming, it’s quite common for two developers to work together when they hit a particularly thorny problem. It’s usually a little while before someone declares they are stuck and asks for help. With pair programming, this situation doesn’t really arise, so time is not lost with single developers persevering on their own.

The other area it can help with is motivation and retaining focus. Someone is much less inclined to become distracted and spend time on facebook, for instance, when they are working with a colleague.

The motivation advantage reminds me of DIY in my case. I hate DIY! I will put it off for as long as possible. I’m simply not interested enough, so it doesn’t get done. My solution to this? Invite my father-in-law round! Once he’s in, he’s so keen to get started, and I have to get it done because that’s why he came over. He gets me started and keeps me focused. Hopefully you don’t have wide-spread motivation problems in your team, or you have deeper problems to worry about! But we all go through short periods like this, and pair programming keeps them to a minimum.

On the other hand, pair programming also has some disadvantages.

In the short-term, there is a loss of productivity, or at least perceived productivity. You have to have sufficient budget to put two developers on each piece of work. If your team needs specialist skills, you have to have a team where there are at least two people with each major skillset. And when you need to hire another person, you ideally need to hire in pairs.

I think it’s also important that the team members have the right chemistry. That they spark off each other. And can work closely together without differing opinions causing endless frustration. There’s a loss of autonomy, having to explain everything and constantly build concensus. Sometimes you’ll be constrained by your partner; other times they may be going too fast for you.

This reminds me of back-seat drivers. It’s so annoying when someone sitting beside you keeps interfering and just won’t let you drive how you want to! It’s tiring and frustrating.

These are important soft-factors that can make or break pair programming in practice.

In the end then, like many agile development practices, you have to look at the unique circumstances of your team, and understanding these factors, decide for yourself when and if to adopt pair programming.

There is currently a discussion on pair programming on my new Agile Community. If you have something to add, why not go and join in?

Kelly.