Skip to content

What is Pair Programming and How Can It Help You Grow as a Developer

This article was written over 18 months ago and may contain information that is out of date. Some content may be relevant but please refer to the relevant official documentation or available resources for the latest information.

Pair programming is when two developers work together on the same section of code to solve problems and build better software. But why is this technique so popular and how can it help you grow as a developer?

In this article, I will break down how pair programming works, and explain why it is beneficial to your growth as a software engineer.

Who invented pair programming?

Pair programming was invented by software engineer Kent Beck as one of the core principles in Extreme Programming. Extreme Programming (XP) is a set of practices and values to help create high quality software and increase productivity and collaboration on development teams.

Since software development is a collaborative effort, having two developers working through a problem will be more effective than one person trying to solve it on their own.

How does pair programming work on a project?

In pair programming, you will have one person who is coding, and another person who is observing. The person who is coding is known as the driver, and their responsibility is to execute those lines of code. The person observing is known as the observer or navigator and their role is to come up with strategies for improvement and catch errors in the code. It is common for the pair to switch between the two roles during a session.

4 Reasons to Practice Pair Programming

There are many benefits to engaging in pair programming. I am going to list four reasons why you should participate in a pairing session.

Better code quality

You can easily spend hours debugging a problem and trying to find a solution on your own. But sometimes, you need a fresh set of eyes that can help you identify a solution much faster.

Another advantage of pair programming is hearing another developers' perspective on possible optimizations to your code. A good way to look at this would be a live coding review from a peer to help you improve on code quality.

Learning from Other Developers

One of the things I enjoy about pair programming is the ability to learn from other developers. In my pair programming sessions, I have learned about new techniques, new tools for optimizing my development environment, and keyboard shortcuts to make my life a little bit easier.

This is also an opportunity to learn more from my coworkers, hear their perspectives on software, and see how they tackle issues.

Better Team Collaboration

Great software is never built by just one person. It is a collaborative effort made by many individual contributors working together as a team.

Pair programming is a great way to build up a healthy team collaboration and create high quality results. It is also a great way to learn more about your teammates' coding styles and approaches so you can effectively work with them.

Building up technical communication skills

All developers need to learn how to effectively communicate their ideas and technical approach to their team. Pairing with another developer can help you practice your communication skills.

You will learn pretty quickly if other developers can understand you, or if you need to work on different ways to communicate your thoughts properly.

When Should You Engage in Pair Programming?

Not all situations will call for a pair programming session. If you are working on a small bug fix that you can tackle pretty quickly, there probably isn't going to be a need to bring in another developer. But if you are brand new to a codebase, that can be a great opportunity to pair with someone more comfortable with the project.

I have paired with developers new to a project and helped them get better acquainted to the codebase and answer their questions concerning the project. I have found that pair programming has helped them onboard faster to a project then if they just tried to figure out everything on their own.

It really depends on the situation on whether or not it is appropriate to pair with someone. From my experience, if I am working on new features or learning a new technology, I will try to pair with another developer and learn from them.

Things to avoid when pair programming

There are some key things you want to avoid doing when pairing with another developer.

Avoid passive aggressive comments

Comments like, "I wouldn't have picked that complicated solution" or "what a unique variable name" will usually lead to an unproductive pairing session. It is better to be constructive and say things like "this solution can be better optimized for x,y,z reasons" or "this variable name is more descriptive and will help developers understand your code better".

By providing constructive feedback with actionable items, the developer that is coding can understand the reasons for the change and not feel personally attacked.

Overzealously Correcting the Developer Who is Coding

If you are in the observer role, let the other person code for a little bit, and give them a chance to fix their own errors. If you interject every two seconds, then you are robbing them of that opportunity to learn and fix their own mistakes.

There is always a delicate balance between when to inject and when not to. The more you are involved with pairing sessions, the better you will know when to provide feedback.

Having One Person Dominate the Pairing Session

In effective pairing sessions, two developers collaborate and share ideas to create stronger software solutions. This process does not work if one person is sharing all of their ideas, and the other is just silently coding away.

The pair should be able to both share their ideas, ask questions, and arrive at a solution together.

Is Pair Programming Only Used on the Job?

I don't believe that you should wait to start pair programming until you get your first software job. If you plugged into a good tech community and have built relationships with people, you can reach out for pairing sessions.

I am involved with the Virtual Coffee community, and they have a help and pairing channel in Slack where people can ask questions and pair with each other.

I have also paired with other developers on issues or new features for open source projects with which I was involved.

How to Overcome the Fear of Pairing with Someone

I know a few developers who are afraid to pair with someone else because they don't feel like adequate developers, and fear judgement from their peers.

If you are in a healthy team environment, these pairing sessions can help you realize that your teammates do value your contributions to the project. This could be a great way to grow and build your confidence as a developer.

My advice would be to reach out and take that first step to pair with your teammates even if it is a little scary. It could help you work through issues of imposter syndrome and build deeper relationships with your coworkers.

Tools for effective pair programming

There are many great tools out there that enable two developers to work on the same codebase remotely. Here is a list of some tools to consider for your next pairing session.

Conclusion

No matter where you are at in your career, everyone can benefit from pair programming. I encourage you to reach out to your coworkers, or developers in your community, and start pairing with them.

This Dot is a consultancy dedicated to guiding companies through their modernization and digital transformation journeys. Specializing in replatforming, modernizing, and launching new initiatives, we stand out by taking true ownership of your engineering projects.

We love helping teams with projects that have missed their deadlines or helping keep your strategic digital initiatives on course. Check out our case studies and our clients that trust us with their engineering.

Let's innovate together!

We're ready to be your trusted technical partners in your digital innovation journey.

Whether it's modernization or custom software solutions, our team of experts can guide you through best practices and how to build scalable, performant software that lasts.

Prefer email? hi@thisdot.co