Pair Programming

What is it? How does it work? Does one of you sleep while the other works?
These are some of the questions that people have asked us about pair programming. Hopefully I can explain the core concept and why it is a good thing, at least from our experience.

2020-10-13 (3 minute read)

Pair programming is an agile software development technique. That means two developers work behind one PC, but not necessarily behind the same keyboard/mouse and monitor. We for instance use one PC, two keyboards, two mice and two monitors in a duplicate desktop mode.

Q: How exactly does pair programming work?
A: It’s quite simple actually, the whole idea is that one of the developers is a “driver” or in other words, writes the code. And the second developer is the “observer” or in other words, the one who reviews the code while it is being written and is in support mode for the driver.

Q: How does the “observer” help the “driver”?
A: The whole idea is to let the “driver” focus on writing the code and the “reviewer” should help guide him to better ideas when the need arises or even address potential bugs that the “driver” might have not noticed. There is a saying that “Two heads are better than one”, which cannot be more true for pair programming.

Q: Isn’t it better to have two separate developers?
A: From our experience, not really. In fact, pair programming reduces the time a developer spends doing personal things, such as visiting YouTube, chatting with friends or having long phone calls. Typically people want privacy to do their personal things, but having one PC with a shared screen, limits the things you can really do, besides concentrating on work. Of course we take breaks, but we take them at the same time to maximise the time we spend on working.

Q: What are the pros and cons of pair programming?
A: This has to be taken with a grain of salt, because everyone's mileage may vary. But from my personal experience, these are some of them:

Pros:
  • Collective code ownership
  • Increased focus on the work
  • Fewer bugs
  • Ability to integrate new developers (novice/expert) to the project faster
  • Improves communication between developers
  • Developers learn from each other
  • Rapid discussion sessions to increase the quality of production code
  • As a pair you spend less time on brainstorming alone or trying to involve other people to help you out. Sometimes only a few minutes of discussion can save hours of time trying to come up with a solution alone
Cons:
  • Pair programming is not for everyone
  • It does not work if one of the developers is not actively participating
  • It does not work if one of the developers is a “cowboy” or a “superstar” and does not want to listen. The whole idea is teamwork, if there is none, it does not work

Q: But it costs twice as much to have two developers work on the same thing!
A: Yes and no. It really depends on the length and difficulty of the project. If the project is really small and easy, then it might not be the smartest thing to use pair programming. But if the project is longer/bigger and more technically challenging, then due to the pros mentioned in the previous question, means that in the long run you typically save money and have higher quality production code at your disposal.

Keep in mind that there is a lot more to talk about pair programming, but there are many great articles about the topic. For instance here are some scientific research articles about pair programming, if you want to learn more.


Solutional is an agile software development company which has a team of professional engineers who are able to solve all software problems from beginning to the end without any middlemen.

Contact us at info@solutional.ee in case you have any new or existing projects needing help with successful execution.