I saw a bunch of threads this morning on Twitter about pair programming, one of the core practices of XP and agile cornerstone. The arguments were diametrically opposed, either: it’s great, and the overhead is necessary and leads to long-term value; versus it’s terrible, because I need to get in the zone and that requires alone time.
(I don’t really like pair programming either… to be honest, I don’t have the attention span for it. I can get into my own groove, but it’s painful to follow along with someone else for more than a few minutes.)
Let me offer up an alternative: cogramming.
Cogramming is like pair programming, but you’re just programming next to someone on a module or a task that’s related to what they’re doing. (In today’s WFH climate, that might mean opening up a Zoom or a Google Meet, turning your cameras off, muting, and working independently until you encounter an issue that you’d ordinarily deal with inside your own head.) When you reach a checkpoint, or when it’s time to sign off, you can do “mini code reviews” to make sure someone else’s eyeballs have been on your work… and caught any big things that you might not have been able to see.
Does it work? From experience, yes. And there’s a basis for it in the research too, through the literature on collaborative play and group dynamics in kids. (Here’s an article that describes some of that.)
Cogramming can help you realize the benefits of pair programming without the pain of actually pair programming. Plus, managers will love hearing that they’re not losing any apparent productivity by two people working on the same code at the same time. If you’re anti-pair, try this approach before you give up entirely.