Pair programming is a software development technique where two programmers work on a single task, simultaneously and collaboratively. The idea is to eliminate errors and omissions while increasing creativity and productivity. It can also provide some team members with training and experience in new skills. It helps programmers work together to share the load, improves the quality of the code, can reduce integration time, and speeds up debugging.

Switching from solo programming to pair programming can be intimidating. People may feel insecure or not know how to start a coding session or what steps it should take. Some developers even have trouble figuring out who should be in charge. However, that's just a first impression. Pair programming is just a way for developers to work on a project together and easily share their knowledge. It can be helpful for establishing a shared understanding of the problem, and the solution. In the end, it will help both people do their job better.

Here you have some tips on how to get started with pair programming and have a great first experience.

What's the best time to start a pair programming session?

via GIPHY

It depends on what you are trying to achieve with it. A pair programming session could be done because its part of the team's methodology or when trying to accomplish a specific goal, like debugging, code refactoring, mentoring a junior developer, or learning something new.

A pair programming session could be used when working on a problem that is too difficult to solve in one sitting, or when two people want to collaborate on the same task. It can also be used when one programmer wants to learn more about how another programmer works.

As you can see, there are several opportunities for pair programming and it will depend on your objective. Some teams have a fixed schedule that they always code together in the morning and others might be more spontaneous. Find a time that works for you without worrying about conventions.

Pair programming template

  • Define the duration and the goals for the session
  • Define the tasks you want to accomplish.
  • Define how often you are going to switch roles.
  • Track the time and put an alarm to when you need to switch or stop.
  • Work together.
  • Review the session and schedule the next session.

What is the ideal length of a pair programming session?

The duration can be flexible depending on how comfortable you are with your programming partner and what you need to get done. If that's your first session, do a limited session of 30 or up to 60 minutes where you and your partner switch roles frequently (like every 10 or 15 minutes). In this way, you can see how you feel and adjust it for the next session.

The most important thing is to have a productive session. As you get more experience, you can do longer sessions that last for a couple hours. Just remember to keep switching roles during the session. Someone starts leading and after some time somebody else leads.

What tools to use?

Duckly in action
Real-time typing on Duckly

First of all, you should be using your own IDE. You should be comfortable with your IDE and its setup. Your partner should also be using their favorite IDE. That's how both can be productive and work faster.

Have a simple notebook (paper or digital) for writing down things that you'd like to comment on later. You don't need to be always commenting, so if you have something to say later, be sure to write it down so you don't forget it.

For doing the pair programming session there are basically two ways you could do it. In-person or remotely. In this post, we are considering that you are working remotely with your team and the session will be done online. We naturally can't avoid mentioning Duckly and how you can use it to make your pair programming sessions more productive. With Duckly you can use any IDE you want and your colleague can use their IDE of choice. You can also share the server and terminal, making the session more complete and productive. Duckly also has audio and video calls integrated, so you don't need to use multiple tools at the same time.

How to find a good partner?

via GIPHY

For the first time doing pair programming, it's best to find someone with more experience or that already have paired in the past. You can start following, really learning before it's your time to lead the session.

It's also important to find someone that you feel comfortable with, someone that you can work with without any fear of feeling stupid or that someone is judging you. The goal is to work together and learn from each other, not to show who is better or make someone feel bad about its skills.

The reason pair programming has become so popular is because it helps programmers work together. Start by talking to developers you work with on regular basis. Many programmers could be looking for a partner but didn't say yet. When your team is small, pair programming also helps you to expand your scope and stay on top of things.

Some programmers simply enjoy working with others. That's the perfect time to start a new pair programming session. Pairs who work together in pairs collaborate better, even when working on completely different parts of the code. It increases cohesion, clarity, and team collaboration.

Practice pair programming

via GIPHY

The best way to learn how to do pair programming is by practicing it. Start small to test the waters. Beginners should start with shorter sessions, but do it regularly. You can start with sessions of 30 minutes every day with a senior developer. A week later you can start to have longer sessions and experiment more.

You don't need to do anything fancy or complicated. You don't even need to call it a pair programming session. Conventions and strictness are not the most important thing. Pairing is very much about a give-and-take relationship, where both parties should be ready to share ideas, accept criticism, and even struggle with the task at hand.

Double down on your ability to work as a team. This includes practice pairing to improve your communication skills, developing positive teamwork behaviors, building productive working relationships, and making sure your teammates have a positive experience with each other.

Happy pairing!