What is Pair Programming?

Jessica Seo
4 min readJul 25, 2020

--

For my first(and hopefully not last) post, I would rather pick something unchallenging that even non-programmers might find interesting. (Btw if I continue writing, my posts will be for people who just started coding with zero background like myself…😬)

Just in case you prefer this article in Korean — > here

Pair Programming

As the name implies, pair programming is two developers working together as a pair, using one workstation. Usually they share one monitor and each one has their own keyboard and mouse. One of them is the“Driver” and the other is the “Navigator”. It’s an agile software development technique. If you are interested, please check here.

Driver & Navigator

Photo by Brooke Cagle on Unsplash

The Driver is the person who is at the wheel, meaning who is typing the code. A driver only focuses on the code at hand now, so doesn’t have to think about a big picture. A driver should think out loud and explain and share what s/he is doing now with a navigator.
The Navigator is the person who steps back and reviews the code on-the-go, while the driver is implementing some logic. A navigator should see the big picture, shares thoughts, directions and finds errors or bugs. Also, a navigator makes notes for next steps or obstacles.
Note: A navigator is not a person who drives strategy! Leave the details of coding to the driver, and complement what driver is missing. Let the driver lead the way!

Benefits & Challenges

Benefits

  1. Effective Knowledge Sharing
    I think it’s very clear and obvious. Pair programming brings not only knowledge sharing to the pair but also to the whole team. It’s a real good chance to update your whole team’s tech skills! The pair can find a better solution while they discuss the problem. Mostly, people on a team don’t all have the same level of experience, nor the same background. So the pair can come up with different approaches and solutions, even alternatives.
  2. Keeping Focus
    When you work alone, you can get easily sidetracked. (Let’s be honest. I know your mind wanders off the task at hand during work🤓) Pair programming makes it easier to focus because there is constant communication about what you are doing, why and what is the next step, etc.
  3. Fewer bugs and code review on-the-go
    It is easier to find errors and bugs at an earlier stage with 4 eyes (than your own 2 eyes 👀). When you approach a problem, you communicate with your partner. That means while one person is implementing, the other can review the code at the same time. It saves you lots of time comparing your refactoring and falling into debugging hell after you already built everything.
  4. Developing skills and achievement
    You can learn your partner’s skills that you don’t have right now, and can develop your interpersonal skills from pair programming. Especially for a junior dev — a senior dev pair, the junior dev can have a chance to learn the senior dev’s skills, logic, and approach to a problem. Coding together helps you understand the problem better, and learn faster. It can also help you feel some type of achievement, and can help someone appreciate the value of teamwork.
Edgar Acosta Chaparro, Aybala Yuksel, Pablo Romero and Sallyann Bryant, 2005, Factors Affecting the Perceived Effectiveness of Pair Programming in Higher Education, IDEAS Lab, Dept. Informatics, University of Sussex, Available from https://ppig.org/files/2005-PPIG-17th-chaparro.pdf

Challenges

  1. Pairing can be hard
    When working alone, you can take as many breaks as you want, whenever you want. Pairing forces you to keep focus and communicate with your partner for a long time. This can be mentally draining. You could also be paired with a partner with a different work rhythm than yours. This can be intense and make you exhausted.
  2. Different level of experience
    Don’t be anxious if your partner has lots of experience! Don’t assume they know everything and know best. In reverse, don’t assume your partner can’t contribute if s/he has less experience! 🙅🏻‍♀️ S/he will have different views from your accustomed ones.
  3. Hurting Self-Esteem
    You might feel repulsed by pair programming because you think your partner criticizes you and your code. Don’t take it personal. It’s just a debugging and refactoring process to produce a better solution. In this case, both of you need to think about the best ways to communicate.
  4. Efficiency
    You might be thinking ‘Why should I do the same work together? It’s less efficient! I can finish it real quick! I don’t need any help!’ Maybe you are right. It might waste time and you don’t need pair programming if it is a really simple job. Just write the code and move on! But…what if it’s a really really difficult problem to solve alone? Hmm….maybe you want to consider a code reviewer? 🤔

Other Pair Programming Styles

Ping Pong

Photo by Frederick Tubiermont on Unsplash

Ping Pong is a programming method that is based on Test-Driven-Development(TDD). Dev A writes a failing test(Ping), and Dev B implements codes to pass the test(Pong). Dev B writes the next test(Ping), and Dev A does the Pong. After each test, two devs should refactor (and debug) together before moving on to the next test.
There are more styles of pair programming. Check here for more details.

Pair programming can’t be the ‘always right’ answer for development. But we all know that;

“Two heads are better than one.”

Happy Coding!

--

--