Pair Programming: Will It Make You Hate Your Colleagues?

images

Introduction

I recently interviewed for a company who believed in pair programming one hundred percent of the time on all projects. It got me thinking about how pair programming, on this scale, would impact me as a developer and whether it would actually be effective and useful. This blog post will explore and analyse the benefits and costs of pair programming one hundred percent of the time as a software development technique.

The Concept

Pair programming is an agile software development technique where two developers work together at the same computer. The developer who actively implements the program is known as the driver, while the other is the observer. The observer’s role is to continuously monitor the work of the driver to identify syntactic errors, spelling mistakes etc. The observer is also responsible for steering the design of the project in the right direction. Both developers switch roles frequently.

There are three possible pairing permutation when pair programming. Novice-novice, novice-expert and expert-expert.

The novice-novice pairing variation has shown an increase in productivity in comparison to developers working on their own [3]. The novice-expert variation makes for a great training tool to introduce a new hire to a development language or framework that they are unfamiliar with [5]. The expert-expert is a powerful variation and can lead to a boost in productivity.

However with each of these variations,  studies and developers [5] have both shown that pair programming is best for solving new, previously unseen problems. This is indicative that pair programming one hundred percent of the time may not be appropriate.

Reaping the Benefits

The aim of pair programming is to improve code quality and efficiency while simultaneously providing an outlet for developers to learn from each other.

Studies have shown that even pair programming by two novices is more productive than a solo developer coding on their own [3]. There are also definitive results that clearly show that code quality improves when pair programming is used. It has been shown to reduce defects by up to 15% [1]. Having the code the driver is writing be constantly reviewed by the observer leads, not only, to more errors being caught immediately. It is also more efficient to constantly review the code than to only review upon completion.

One of the nicest benefits of pair programming is team building.  It encourages better communication and collaboration. Programming is often depicted as a solitary task and developers as shy, quiet people. Pair programming, however, forces developers to actively work together which can lead to more productive teams, not just individuals . Most of the studies referenced below, point this out [1][2][3].

However, one key factor that is evident from all these studies is that they don’t seem to have considered what pair programming is like if it is being carried out one hundred percent of the time, all day, everyday. While it is true that developers don’t code all the day, there are a number of scenarios where pair programming one hundred percent of the time may not be the best course of action.

100% Pair Programming: Yea or Nay

While empirical studies prove that pair programming is one of the best things to happen in software development, I am not convinced by them. The one factor that they do not seem to take into account a great deal is  the ‘human’ factor.

“In the name of (short term) productivity” – Mark Needham [5]

The implementation phase of a software project is not all just about overcoming challenges. All projects have mundane and often trivial code that needs to be implemented to carry out the most basic of tasks. The problem is that the observer will just have to observe this dull, trivial  process without being able to contribute anything useful. Their skills could have been put to better use in implementing a critical piece of code, or another piece of trivial code which had yet to be implemented. The approach of pairing one hundred percent of the time can lead to a waste of a developers time and talent. This could slow down the development as there may be many other pieces of code yet to be implemented which could be implemented by the observer. This argument still holds when the developers switch roles.

Pairing all the time is also a terrible way for a developer to learn to use any development tools. Watching the driver make use of various tools, or watching them figure out how to use these tools is not educational. Some tasks need to be completed by the learner themselves to be able to fully understand them. This is similar to a person claiming they can play basketball because they have watched a few games on TV.

In addition to this, there is a time for individual work unhampered by the need when mundane tasks.

“You don’t want to waste their time. You don’t want to argue (unless the other person wants to as well). You give in more often than if you were working alone.” – Mark Wilden [6]

Pair programming depends on the abilities of two developers to successfully collaborate and work togethe. The studies below all assume that people will get along with each other the entire time. Perhaps this should be the case in a work environment as professionals are expected to put aside their feelings, but realistically that this is simply not the case. This is not implying that they may resent each other (they might), but they may disagree a lot when it comes minor design decisions. This may slow down the pace of implementation and in some cases lead to one developer believing that their opinion is not correct or worth taking into account. This can be quite demoralising, leading to feelings of resentment. This could be prevented if pair programming weren’t being carried out constantly and only major design decisions were discussed, leaving the minor decision to the coder’s discretion.

“Pair programming doesn’t encourage quiet reflection and exploration.” – Mark Wilden [6]

As a developer, getting a feel for the language and codebase is quite important when it comes to implementing designs. Just as children learn by trial and error, developers learn by exploring the code. Many innovative ideas can also stem from exploring the codebase; refactoring certain classes for example. However, if a developer never gets enough time to work their way through the code or language then they can never truly get comfortable with it.

The Bottom Line

Like Wilden and Needham, I think pair programming should be used in moderation. In my own limited experience as a developer, I faced days where my productivity was low. It could be argued that on these days pair programming all day would have helped this, but I don’t think it would have. Almost everyone who has has some work experience can relate to days where your brain does not seem to want to function properly. The mind doesn’t think straight; logic, which was always like second nature is baffling and even words escape you. On these days a developer just wants to get through the day. These unproductive days have always been compensated with extremely productive, slightly longer, working days. However if forced to pair program all day on such days then I’d have to say that it most likely would not have resulted in feelings of hatred, however it may have led me to associate negative feelings with programming with my pairing partner. This is not a failing on the concept of pair programming alone, in fact pair programming in small increments may help, but on human nature.

Pair programming is incredibly beneficial and should be used in moderation especially when used to exchange knowledge. It can make a great coaching tool and when used to solve a new, unseen problem it can help teams work together to design innovative solutions .  However pairing one hundred percent of the time should be approached with caution to ensure that colleagues do not develop mutual feelings of annoyance towards one another.

References

[1] D. Winkler, M.Kitzler, C.Steindk, S.Biffl (2013) ‘Investigating the Impact of Experience and Solo/Pair Programming on Coding Efficiency: Results and Experiences from Coding Contests’, Agile Processes in Software Engineering and Extreme Programming [Online]. Available at:http://download.springer.com/static/pdf/742/chp%253A10.1007%252F978-3-642-38314-4_8.pdf?auth66=1392496570_5aef1fdad11e1c3331f4cd4351cbf951&ext=.pdf.

[2] Erik Arisholm, Member, IEEE, Hans Gallis, Tore Dyba˚, Member, IEEE Computer Society, and Dag I.K. Sjøberg, Member, IEEE (2007) ‘Evaluating Pair Programming with Respect to System Complexity and Programmer Expertise’, IEEE TRANSACTIONS ON SOFTWARE ENGINEERING, 33(2), [Online]. Available at:http://simula.no/research/se/publications/Arisholm.2006.2/simula_pdf_file.

[3] Kim Man Lui, Keith C.C. Chan (2006) ‘Pair programming productivity: Novice–novice vs. expert–expert’, [Online]. Available at:http://www.cs.utexas.edu/users/mckinley/305j/pair-hcs-2006.pdf.

[4] Alistair Cockburn, Laurie Williams (n.d.) ‘The Costs and Benefits of Pair Programming’,[Online]. Available at:http://collaboration.csc.ncsu.edu/laurie/Papers/XPSardinia.PDF.

[5] Mark Needham (2011) Pair Programming: The disadvantages of 100% pairing, Available at: http://www.markhneedham.com/blog/2011/09/06/pair-programming-the-disadvantages-of-100-pairing/ .

[6] Mark Wilden (2009) Why I Don’t Like Pair Programming (and Why I Left Pivotal),Available at: http://mwilden.blogspot.co.uk/2009/11/why-i-dont-like-pair-programming-and.html.