Pair Programming – An Extremely Agile Practice

Pair Programming - An Extreme Programming Agile Practice.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 perservering 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?


Photo by kurtthomashunt

4 Responses to “Pair Programming – An Extremely Agile Practice”

  1. Pawel Brodzinski says:

    There's one more issue with pair programming. If your team doesn't believe pair programming actually works and improves performance they'll most likely prove this.

    This kind of cooperative work requires specific mindset of both engaged persons. Otherwise you lose much, if not all, of value pair programming can bring.

    The problem is rather painful since typical developer has never programmed in pairs and is rather skeptical. That's why if your team programs in pairs you should recruit new people very carefully.

    By the way: I gave developers much freedom to choose practices they follow in a couple of teams I led and they never even tried pair programming. I can't even remember if anyone was enthusiastic about the idea.

  2. Ilja Preuß says:

    I don't share the experience that for Pair Programming you need an extra budget. I also don't see why you'd need more people with special skillsets – in fact, I'd argue that exactly the opposite is true. Regarding hiring in pairs, I've never seen that being necessary.

    It's true that pair programming can be socially challenging. I wouldn't throw out the baby with the bathwater here, though: it's a skill that can be learned, and from which you will highly benefit outside of pair programming, too.

  3. Dave Hopkins says:

    Great Article. I found it very interesting, and I've actually tried it myself with fair results. One thing I've found (As Pawel Brodzinski said above) is that, like anything else, if your thinks something wont work, they may create a self fulling prophecy of failure.

  4. clutterfreecoding says:

    Thanks for posting this. Very inetersting. I have recently found another site, which expresses rational software development in pictures

Leave a Reply

What is 10 + 2 ?
Please leave these two fields as-is:
Please do this simple sum so I know you are human:)