DEV Community

Cover image for Why Should You Care About Pair Programming?
Ani Ionova
Ani Ionova

Posted on

Why Should You Care About Pair Programming?

I joined my current company at the beginning of this year and just a month after that the COVID19 lockdown happened, so the whole company ended up working from home. Being the only junior on the team and having very little backend experience, I felt like I needed some guidance on certain tasks I took.

I did everything by the book: read documentation, done my research, asked questions, but many problems I faced were not easily Google-able, they were related to how company codebases worked and how they were structured. The most effective tool for me to solve that problem was pair programming.

Before we dive into the tips, let's introduce some terminology to establish common ground. As per Wikipedia:

Pair programming is an agile software development technique in which two programmers work together at one workstation. One, the driver, writes code while the other, the observer or navigator, reviews each line of code as it is typed in. The two programmers switch roles frequently. (Source)

Here are some tips on pair programming I've gathered along the way:

1. Use every opportunity to learn and encourage learning

I strongly believe that even though pair programming can be difficult to facilitate at times, it is beneficial to both parties when done with the right intention.

The 'drivers' can pass on valuable knowledge, bounce ideas off of the other person, share debugging tips & tricks, and on top of that it feels ohhh so rewarding to share the experience with someone! :) At the same time 'navigators' can pay close attention, catch typos as they occur, suggest solutions, ask questions and get feedback in real time!

2. Don't wORk away in silenceπŸ™‚Think out loud!

It's very tempting to just continue to code in silence, but if you actually talk things through while working on them there's a higher chance to find potential logic flaws earlier, making sure the code quality is consistent and edge cases are accounted for. This practice will also shave some time off debugging issues later on. It might feel a little uncomfortable to initiate a conversation, but once you get started - the work goes smoothly and time flies.

Also if you have an idea or a suggestion, say it, don't overthink it! There are no stupid ideas, and maybe yours could provide a fresh perspective on things and change the direction of the whole session!

3. Use this chance to get to know your team

Pair Programming could be a great way to connect with your teammates. Some of the people joined our team right after the lockdown, so we didn't get to meet and talk to each other in person. Through the sessions I learned a lot about the people I work with: their hobbies, background, likes, dislikes and personalities. I think I've learned more during these sessions than I would've by sitting close to them at the office.

In a nutshell: it's a great team building activity! It's not only about completing a task or a ticket ASAP; it's about team work, being patient and respectful, providing suggestions and listening to another person's point of view.

4. Take breaks!

Pair programming requires a lot of concentration so don't be shy to suggest a coffee, bathroom or a lunch break. This will definitely make the experience more enjoyable and you'll feel less drained by the end of it, especially if you have longer sessions (2+ hours).

5. Share what you know

As you code together, when appropriate, share the tools you use, various tips, shortcuts and commands. If you notice your pair programming partner is not using a shortcut you know and that slows them down, always take a minute to to tell them about it.

We all have different gaps and even the most experienced developers might not know some things. When you teach a teammate something that makes them more effective, the whole team benefits.

Some tools our team has been heavily using while WFH:

  • Slack calls and their built-in functionality

What helped us greatly in establishing good team communication during pandemic apart from various work chats, was the built-in Slack functionality: audio calls + screen share option. It's really handy for someone to show their screen to go over certain things, while others on the call are able to discuss code in real time, to highlight and point to specific lines using the built-in pen.

This was a key tool we used for pair programming, as you can share a live coding session: all people participating just need to be authenticated with their GitHub accounts. One person starts the session and then shares a link with others on the team. That way everyone can be involved in writing code and it allows to swap roles (between navigator and driver) really quickly! If you select a person's name on the left it follows the cursor of the selected team member everywhere they go within the code editor. That makes it easier to follow their train of thought. πŸ”₯

I hope you find this article helpful and I'd be happy if you share your own tips in the comments!

Top comments (8)

sonulohani profile image
Sonu Lohani

I hated pair programming because in my case the one who was doing programming didnt know what he was doing and i have to tell every bits and pieces of the code and he was just typing. I would like to code alone instead together.

anncrypt profile image
Ani Ionova

Oh yeah, the situations like that definitely happen!

Maybe in that particular case it'd be best/less frustrating for you to take the driver seat and for them to be the navigator. What also helps - is when you check on your PP partner every once in a while just to make sure you're on the same page.

davidromero profile image
David Romero

Sometimes there's the pressure to 'perform' to the other person. I personally enjoyed Pair Programming when I'm stuck at a rabbit hole and had tried a lots of things with no success. Then a colleague helps me to see the way out.

hammertoe profile image
Matt Hamilton

I used the VS Code extension for the first time this week. It worked great! I've not actually used VS Code before at all, as generally stick with Emacs. But I was doing a live Twitch show in which a colleague and I pair programmed something for a hackathon. And it worked great.

The fact we were also live on Twitch and had some people in the chat as well meant we really did have to talk out loud and explain our thinking. Which invariably lead to better code and a better end result. And with both of us (and the audience) learning from it.

anncrypt profile image
Ani Ionova

That's so great that VS Code Live Share worked out for you!! It's really helpful, especially with everything being remote right now..

I'm very curious to check out your video from hackathon! πŸ™Œ

metalmikester profile image
Michel Renaud

Not a fan, unless we're diagnosing a problem. I know some people who like (or even love) it, but it comes down a lot to one's personality. I'm an introvert and a loner and work best alone.

anncrypt profile image
Ani Ionova

Pair Programming is definitely not a panacea! What works for some people may not work so great for othersπŸ˜‰ So I absolutely get it!

renesansz profile image
Rene Padillo πŸ‡΅πŸ‡­ • Edited

For critical issues in production that you can't identify which is causing the issue, pair programming is important.
But most of the time, I don't like doing pair programming especially if I have deadlines to catchup πŸ˜…