Pair programming. Is it a software development wondertool or a pain in the posterior? In this article, the author argues that its alleged benefits are woefully overrated.
Pair programming: People either love it or hate it.
The concept of pair programming first became popular thanks to “extreme programming” or XP—a set of practices that supposedly allows companies to develop software in a more efficient, more “agile” manner. Proponents of XP claim that it allows programmers to respond to changing or ambiguous software requirements without sacrificing quality. Skeptics disagree, arguing that these alleged benefits are either illusory or exaggerated.
XP proponents argue that two programming heads are better than one—that two software developers working together will tend to produce better, more reliable and more maintainable than a single programmer working alone. This practice is known as pair programming, and at first glance, it sounds like a great idea. Personally though, I think that it smacks of a “one size fits all” mentality. That is, it assumes that two programmers working in concert will indeed be more efficient and that they will produce better results. I think there is good reason to believe otherwise.
The much vaunted Williams study
XP fans typically point to an infamous study headed by Prof. Laurie Williams at the University of Utah. In this study, Williams concluded that pair programming takes 15% more time than solo development, but results in software that is 15% better. They argue that this modest increase in development time is a small price to pay, since better code quality means that less time and effort will be required later down the road – during testing and maintenance, for example.
I think that there are numerous problems with this study, though. How did the researchers gauge software quality, for example? The used the length of code as the quality metric; that is, the shorter the source code, the better they deemed it to be. The reported, “[The paired teams] consistently implemented the same functionality as the individuals in fewer lines of code. We believe this is an indication that the pairs had better designs.” I think this is a hasty leap of logic, to say the least!
Does shorter source code exhibit greater quality? Sometimes, perhaps. However, one could just as easily speculate that the longer code contains more bug fixes and safeguards. In addition, adding more code lines – to implement a design pattern, for example – can make the software more efficient or easier to maintain. I think that the presumed correlation between code length and lack of quality is poorly justified at best.
The study also exhibited a severe case of participant bias. The students in a class were asked if they preferred to work in groups or alone. 35 of the respondents said that they preferred collaborative working; of these students, 28 of them were selected to constitute the pair programming experimental group. The remaining seven were placed in the solo programming group, i.e. the experimental controls. This created a strong experimental bias; all of the pair programmers were willing volunteers, whereas some members of the control group were there reluctantly.
What’s more, 13 out of the 14 pairs were self-selecting; that is, students were allowed to pick their partners willingly. Once again, this biases the results, since participants are likely to select partners with whom they are particularly compatible.
(Interestingly enough, these biases could have been easily avoided by assigning pairs randomly. I don’t wish to cast aspersions; however, I can’t help but wonder if Prof. Williams and company might have unconsciously biased their experiment to demonstrate the superiority of pair programming.)
Short-circuiting the creative process
In short, the supposed evidence for increased productivity under pair programming is questionable at best. In addition, we should ask if there’s any reason to believe that pair programming can be counter-productive or otherwise harmful.
I believe that it can be. Pair programming can certainly help people catch or prevent bugs; as the hoary cliche goes, two pairs of eyes are better than one. When faced with a thorny problem though, one often needs to let the problem percolate in one’s brain for a while before arriving at a proper solution. Often, that’s how creative minds operate; they need to let their minds sift a problem first before attempting to fix it.
With pair programming though, this process is short-circuited. Instead of letting one’s mind digest the problem in due time, pair programming puts pressure on people to arrive at a solution more quickly. Sometimes, this may produce better results; however, it can also have the opposite effect. I suspect that for the most creative minds, this kind of pressure can stifle creativity rather than hinder it.
But wait! Isn’t there power in numbers? Aren’t there times when the best results are produced by having people brainstorm and confer? Certainly… but these “meetings of minds” don’t have to occur during the programming process. They can occur during planning sessions, during design reviews, or when sitting around a lunch table. We shouldn’t dispense with group troubleshooting and design; we simply shouldn’t force this to occur at the coding stage. That can do more damage than good.
What’s more, the most creative minds often need a measure of playtime – an opportunity to play around with the code, tentatively exploring various options and letting one’s mind roam free. This can be difficult to do when another programmer is looking over your shoulder. After all, what should we do – explain and discuss every tentative step? For a creative mind, this can be stifling indeed.
Conclusion
In short, I think that the evidence for pair programming’s effectiveness is questionable and overblown. I also think that there’s good reason to believe that pair programming can stifle the creative process, instead of helping it. Can pair programming be helpful? Certainly… However, when forced upon people, it becomes a “one size fits all” strategy—and unfortunately, a single size can’t possibly fit everybody, no matter what the salespeople say.
One description that you should never use in a singles profile
Learn how to avoid an all-too-common mistake when writing a singles profileA few tips on social dance etiquette
New to social dancing? Here are a few pointers to help make the experience a pleasant one.The Pitfalls of Overusing 'Get' and 'Set' in Object-Oriented Programming
Over-reliance on getter and setter functions in object-oriented programming can undermine the very principles it stands for, such as encapsulation and information hiding. This article explores why excessive use of these functions can be detrimental and offers insights into more effective programming practices.