Posted by javaerb
on September 23, 2003 at 12:50 PM PDT
I'm probably not the first one, but I just witnessed a revealing aspect of pair programming.
My company is not really an eXtreme Programming shop, but we are somewhat inspired by it. We are currently doing a project in which some people are involved in pair programming. I recently witnessed an amusing situation involving this practice. The team that works at the other desk in my office found a bug which they could not figure out. They came to the conclusion that it might be in the part of the system which I work on (alone). After analyzing the situation, I realized that their code contained a rather obvious (well, not hidden, once you figured out what it was) error.
I found this amusing because pair programming is supposed to be all about the "second pair of eyes." But that doesn't mean a second mind. I remember once hearing one of those million corollaries of Murphy's Law. It said something about how, when you cannot find a bug, if you call someone over they will not find it either, but some unsolicited person walking by and looking over your shoulder will see it immediately.
XP makes the fatal error of ignoring Murphy. Two people working together might spot each other's mistakes, but they might also buy into a shared illusion -- the illusion that they are right. We know about mob mentality, how tens, hundreds, even thousands of people can be stupid all at the same time.
Of course, other aspects of XP, such as writing tests, heavily counterbalance this problem. This may be a good argument against the habit of picking and choosing the parts of XP one likes, rather than doing it all the way. But perhaps it also shows that good old code reviews may be at least as good as pair programming. This assumes code reviews are carried through. I have been at several jobs where we started out with the intention of having code reviews, had maybe one or two, and then it fell by the wayside. One good aspect of XP is that it imparts discipline through habits. If you are pair programming, there is nothing to schedule, you are just doing it.
So I guess I don't have a point here other than that pair programming, at least by itself, has serious pitfalls. But then, I have old-fashioned habits. I used to use punched cards.