Pair Programming Considered Harmful?
techcrunch.com
techcrunch.com
I love the company that I work at, so I'm not likely to let pair programming dissuade me from staying there, but when if and when I do look for a new job (or start my own company), I would be very wary of a shop that uses pair programming extensively. I really love working in a team and directly with others on projects, but pair programming can be very tedious, particularly if there is a big gap in experience between the two people in the pair.
We also use code reviews for all code that goes to production. I find this to be extremely valuable. For more complex pieces of code, we do 'design proposals' that are circulated within our small team (4 developers) to get feedback and improve the design of our code.
Code reviews in groups often work really good despite different levels of experience though.
It is exhausting to do pair programming, but when it really does work the feeling of progress and mutual knowledge sharing is awesome. In these optimal cases me and my coworkers have worked in pairs for 5-6 hours per day. Pushing on for longer would not have gained anything, rather the opposite.
Of course it does help that when my explanations truly fail, I still have the nuclear option (Hey, they pay me to teach you this stuff, so just believe me) available, but (I'd like to think) I only rarely use it.
If you have skilled developers they will work more efficiently the less "management overhead" that is put upon them (processes, checklists, methodologies etc). They will simply self-regulate and a large amount of output of high quality. As the skill/experience of the developers in an organization drops management typically implements practices to better ensure quality. While providing checks and balances for the lowest denominator these will also typically slow down the best.
This is especially nefarious when you consider that a "great" programmer can be 10x (or more) as efficient as an average one. That's probably because they developed habits that make them so, and now you risk meddling with those habits. Making a 10x as efficient programmer 20% less productive can be costly.
The most insidious thing about this as top performers typically can stomach only so much "crap" that slow them down before leaving for another job. Which leaves the organisation with even less skilled workers that need even more "overhead" to control which in turn results in even more "good" employees leaving. Iterate a couple of years and you have an organization where it is very hard to do anything wrong but also almost impossible to get anything done because of all the committee's, best practices, etc
Of course pair programming is going to slow the best programmers down without adding much benefit. On the other hand for bad to average programmers pair programming will probably result in better code with will offset the reduced efficiency. From an organizational standpoint pair programming will reduce dependency on any one programmer.
It's up to every company to decide which trade-offs they're willing to make and balance that against the kind of employee's they have. Some lightweight practices might actually be beneficial even for the top performers but they do take some serious consideration to get right.
If you can manage it, hire really good developers and get out of their way.
To contribute zero a bad programmer would have to just sit around and reddit all day or whatever. Once the bad programmer starts writing code he is almost surely a net negative since eventually someone is going to have to rewrite his code and unless the code is completely decoupled from everything else, the time required to do that rewrite will exceed the time it would have taken if the bad programmer had never written any code at all.
"Programming managers have long recognized wide productivity variations between good programmers and poor ones. But the actual measured magnitudes have astounded all of us. In one of their studies, Sackman, Erikson, and Grant were measuring performances of a group of experienced programmers. Within just this group the ratios between best and worst performances averaged about 10:1 on productivity measurements and an amazing 5:1 on program speed and space measurements! In short the $20,000/year programmer may well be 10 times as productive as the $10,000/year one. The converse may be true, too. The data showed no correlation whatsoever between experience and performance. (I doubt if that is universally true.)"
Just a single experience - a proper academic study would be very interesting if someone could manage it - but it doesn't seem to match your theory.
My point is not as much about specific practices but rather about mandatory ones.
[1]: http://meyerweb.com/eric/comment/chech.html
And the quality of this article just proves the point, I think.
Around the time it was founded, I'd say
I've always thought that for the purpose of improving code quality and transferring knowledge, a formal code review process is much, much better. Indeed, I've always wished more development shops would utilize a code review process of some sort.
1. http://www.spenceruresk.com/2009/03/impaired-programming-how...
- The problem can be that programmer A is stuck on a piece of code or debugging: this is usually part of a bigger task which A has as the top thing in their mind, but for some reason can't make progress. Programmer B brings a fresh pair of eyes to the table, but looking at it alone makes no sense, because their mental model will be up and running much faster with A's help.
- Onboarding. Programmer B is new to the project and programmer A gives an increasingly hands-on crash course of the project workflow and B's first task.
- The high-level parts of major refactorings. Neither A nor B will have the whole existing structure of the code completely in their heads, but between them they have a more complete picture and stand a much better chance of not messing it up.
None of these should take more than a few hours, or maybe a day max, or you probably will go insane, yes. It probably also depends on personality, but you should hopefully not have any homicidal tendencies after just a few hours.
It is only when pairing consumes most of your day for days or weeks on end that it gets really tiring and counter-productive.
There are so many things that can vary from project to project: How big is the system? What level of expertise does each developer have with the domain, or with the tools being used to build it? What are the personalities of all the people involved? Is the system a cutting edge research project or a well understood thing that just doesn't happen to exist yet?
All of these variables, and lots more, would influence my decisions about who I'd want to work with, and (if there is someone other than me) how we'd work together.
Given all that I consider it extremely unlikely that there are any useful and universal conclusions to be drawn.
On a personal level, I absolutely detest the very idea of fulltime pair programming, but I assume that its because of my personality. I hate it so much that when I was interviewing for gigs, the first thing I would ask is if they pair programmed, if they did, I'd politely remove myself from the running for that position with the company.
I have my moods, sometimes I want to work for 18hrs straight, sometimes, not so much. Sometimes I want to go down a rabbit hole that I know is stupid, I just want to because its exciting to try out possibilities. I hate that pair programming would seem to preclude all that (again I might be wrong).
I don't want to constantly be explaining why I'm doing something, it just seems tiring. It takes something I enjoy and turns it into 'work', where I'm just coding with someone, day in day out 8 hours a day. Good for the company I suppose.
I'm sure people love it though, what would be an interesting statistic to see is how many devs would pair program if they didn't have to.
This is my biggest objection to pairing. Usually when I'm first working on something new I don't really understand the problem so I'll slap together a very quick & dirty solution and then either refine it from there or toss it and start over. Being forced to slow down and verbalize my thought process at this stage just slows the process way down and makes me less willing to experiment.
Good code reviews seem to me to provide most of the upside of pair programming with none of the downside.
Your suspicions are accurate. I can't find it right now, but I remember reading a thorough study on software and the bugs eliminated by various processes. It was code reviews (multiple variations of them, in fact) that stood head and shoulders above the rest in preventing bugs from reaching production.
Knowing that your mind is free to explore a problem to whatever depth is necessary is absolutely critical to solving something non-trivial.
I find it really hard to explain the damage of interruption to non-programmers. Whether it is a girlfriend or a client that likes to talk while you're fixing their bugs. I don't think it is necessarily unique to our profession, but it is certainly rare enough that most people seem not to get it.
I'm disappointed anyone still believes any of these Methodologies with a capital M will fix their project. All the techniques mentioned should be part of the toolbox, but it's up to common sense to use them appropriately. There is no substitute for common sense.
Still, I was pleasantly surprised after my considerable initial trepidation about reading a programming article on TechCrunch.
[1] or probably doing anything else creative, but I can't speak from experience
[2] and, let's not forget, communicate with the actual users of the software
I think many of us program at our best with a little solitude. Now, I do think "pair programming" can be beneficial with solving a particular problem but this is like something everyone should know just from life.
That said, one of the major techniques that Gawande advocates is the use of checklists, which can be useful even to programmers working alone to make sure they haven't missed some important step (e.g., verifying that their code works against a live server, vs. just passing unit tests). His article in the New Yorker on checklists is interesting in its own right:
http://www.newyorker.com/reporting/2007/12/10/071210fa_fact_...
One of the biggest problems we had was developers getting frustrated inside their pairs, because one of the members of the pair was weaker in some way, either slower, less experienced at the product, or less skilled generally.
Not only this but in a diverse environment with multiple cultures, where various disciplines vary, it managed to increase stress levels a lot also (as an anecdotal example, one of our colleagues was wound tightly and liked to be very procedural, while the rest of us were very laid back). These people all worked great on their own -- and got along -- but as soon as you pair them it all goes to shit.
"We sat down one morning," recalls Steele. "I was at the keyboard, and he was at my elbow," says Steele. "He was perfectly willing to let me type, but he was also telling me what to type.
The programming session lasted 10 hours. Throughout that entire time, Steele says, neither he nor Stallman took a break or made any small talk. By the end of the session, they had managed to hack the pretty print source code to just under 100 lines. "My fingers were on the keyboard the whole time," Steele recalls, "but it felt like both of our ideas were flowing onto the screen. He told me what to type, and I typed it."
The length of the session revealed itself when Steele finally left the AI Lab. Standing outside the building at 545 Tech Square, he was surprised to find himself surrounded by nighttime darkness. As a programmer, Steele was used to marathon coding sessions. Still, something about this session was different. Working with Stallman had forced Steele to block out all external stimuli and focus his entire mental energies on the task at hand. Looking back, Steele says he found the Stallman mind-meld both exhilarating and scary at the same time. "My first thought afterward was: it was a great experience, very intense, and that I never wanted to do it again in my life."
We pair with 2 monitors, 2 keyboards, and 2 mice facing each other with our own desks which I feel gives each person in the pair enough privacy and space to make us both very comfortable.
Is pairing intense? Yep. Is it worth it? Absolutely in my mind. The high quality of the code and the productivity is well worth it.
It's a shame more companies don't implement pairing correctly. The extra grand (less if you don't go with an apple display) for the monitor is a small price for the results you get.
When was the last time you paired with someone other than the person you have been pairing with recently?
I think the other thing the author fails to mention is that in terms of up-skilling developers, the process of pairing is quite useful. Often the pairing will naturally raise the level of the weaker programmer by virtue of being exposed to new ideas and solutions by the more experienced developer.
Pair programming without dual keyboards and mice deserves castigation.
What often happens, is someone would ask me to help them look at something, but they are multitasking multiple problems. Initially I can take over their keyboard & screen, but before long another call comes up and I have to transfer the problem / environment back to my desk, and get back to them (or end up owning the problem completely).
I think having the keyboard & pointer independence combined with an editor that lets you have multiple windows attached to the same edit buffer (like Emacs) would be wonderful.