DEV Community

Cover image for 7 Tips for Successful Pair Programming
Jenny from the B
Jenny from the B

Posted on • Originally published at duckly.com

7 Tips for Successful Pair Programming

Pair programming is a great way to work on a software project and share knowledge. It’s when two or more programmers work together. Usually, one developer is leading while the other is providing feedback and following the development. The benefits of pair programming are many: improved code quality, greater knowledge transfer, and increased motivation and satisfaction among developers. With that said, there are some challenges to overcome when doing pair programming that you need to be aware of.

Here, are 7 pair programming tips for having a productive coding session:

Pair programming tip #1: Plan together

Plan together

Before start programming, plan what you are going to do and what are your goals. Is this about building something new? Debugging? Mentoring a junior developer? Be clear about your goals and communicate them to your partner. It could be that the most experienced developer is responsible for planning, but it doesn't need to be like that. Plan together and have your partner participate too.
Be sure to know a bit about your peer before starting the pair programming session. There are many different ways to do this. Each person should be given the opportunity to chat before the session starts. They can get to know their development’s style, quirks, and preferences. This helps you both understand each other’s mental model and put a plan in practice that makes the session more productive.

  • Plan your pair programming session:
  • What's the task, what we are trying to accomplish
  • Length of the session
  • How often should change roles
  • Any personal preferences

Pair programming tip #2: Change roles regularly

Change roles when pair programming

One of the most common mistakes developers make when doing pair programming is switching roles too often or not switching at all. How often you need to change roles depends on the experience level and how long is the session. If the session is less than 60 minutes long, you can switch just one time. If the session is shorter, it might be more productive to have just one person leading, but you still can switch in the half.
If you are working in a longer session, you need to be more conscious about the roles and when to change. It can happen that you are so focused on the task that you forget about changing roles. That's a mistake. Be sure to change regularly and you can use the Pomodoro technique to help with this.
In summary: to make things simple, start by changing roles every 30 minutes using the Pomodoro timer. Don't let your excitement of coding prevent you from giving the opportunity to the other developer to be leading the session.

Pair programming tip #3: Good audio and video setup

Good audio and video

Naturally, the pair programming tips from this guide are considering that you are working remotely. In this scenario is crucial to have a good audio and video setup that allows you to communicate clearly.
First a basic pair programming tip: Be sure to have a good internet connection and to be in a place without much noise.
Although is not required, it's good practice to turn ON your video camera when pair programming. Communication is not only about what you say, but your body expression, how your face is reacting, etc. By having a video camera active your colleague can be more engaged and the session can be more entertaining for both sides.
For audio communication, be sure to use headsets. You don't need to go crazy with professional fancy audio equipment. Anything that makes you comfortable works. A headset that you can properly hear the other person and that they can understand you is already good enough.
Some tools like Duckly (shameless plug, I know) can help you a lot here as it has all the features for real-time code sharing and audio and video communication.

Pair programming tip #4: Avoid micro-management

Avoid micro-management

One of the most annoying and counter-productive behaviors that can happen in a pair programming session is when a developer starts to micro-manage. This is more common than you know, but really kills the purpose of the pair programming. To have a safe environment for collaboration that increases knowledge sharing between developers.
Micro-management usually happens when one developer is more experienced (or just more opinionated) and try to force their point-of-view, dictate code, and is rigid about how exactly things should be done. This creates a negative feedback loop where confidence is low, more mistakes are done, more line-per-line comments...making the session slower and less collaborative.

Pair programming tip #5: Be nice and patient

Be nice and patient

Similar to micro-management, lack of patient makes the pairing experience much worst. This could happen when working with people with different skill levels and when a more experienced dev doesn't give their partner time to process their code. It can be tempting to be interrupting their flow to quickly correct errors, but this only breaks their flow and confidence. You can always write things down and comment later. This will give you time to understand if that's really a problem that should be fixed or maybe it was already fixed somewhere else (or you didn't notice that there was a different way to solve it).
However, independently if there is a mistake or not, just be nice to people. We are all learning and trying to have a good time. Rule of thumb: Just be a nice person to work and collaborate with.

Pair programming tip #6: Avoid external distractions

Avoid external distractions

Specially when working remotely, there are several challenges and distractions that you need to overcome. Phone notifications, emails, delivery on the door, etc. These interruptions are easier to battle if you are leading the pair programming, but if you are following you can find yourself drifting away on some occasions.
Ignore emails or any media while pairing. Don't schedule meetings that can interrupt your session. On top of that, don't do super long sessions that can last for hours. Take breaks and schedule time for other activities that are not programming.
Be present and respectful with your partner, but also wise about how you allocate your time.

Pair programming tip #7: Constant communication

Constant communication

Pair programming can be challenging, but it can be harder when one person has trouble keeping up or someone feels that they are coding alone. To avoid this, you should be actively communicating with your partner all the time. This will also make the session more engaging and fun. You don't need to be interrupting all the time or commenting on every single line (as we talked before), but let know that you are there for them and that you are working together.
The point of doing a pair programming session is to not be coding alone, so be present and participate with your partner.

Closing thoughts

Pair programming has a lot of advantages in comparison with solo coding: knowledge sharing, better code quality, improved communication. However, it also contains its own set of challenges. These pair programming tips can help you have a great collaborative and knowledge sharing session:

  • plan your session properly,
  • change roles regularly
  • have a good audio-video setup,
  • be mindful about micro-management,
  • be patient and nice with your people and
  • communicate with your partner.

Top comments (1)

Collapse
 
jonrandy profile image
Jon Randy 🎖️

In my experience, pair programming is a surefire way to reduce productivity and cause arguments. I would advise avoiding it