Want to be a developer? You should probably be Pair Programming.
The stereotypical image of a software developer is the lone wolf coder, working late into the night in isolation on complex problems. However, this perception is far from the reality of how modern software is actually built. In the real world, development is a highly collaborative team effort, with programmers frequently working together to produce high-quality, robust code.
One of the most powerful techniques for collaborative coding is pair programming. If you‘re learning to code and hoping to break into a development career, pair programming is a skill you‘ll definitely want in your toolkit. In this article, we‘ll take an in-depth look at what pair programming entails, examine the compelling research-backed benefits, and share expert insights on how this practice can turbocharge your growth as a developer.
What is Pair Programming?
Pair programming is an agile software development technique where two programmers work together at a single workstation. One programmer, called the "driver", physically writes the code, while the other, known as the "navigator" or "observer", reviews each line as it is typed and provides strategic direction. The two programmers switch roles frequently, ensuring that both get experience driving and navigating.
During a typical pairing session, the driver can focus their full attention on the tactical aspects of completing the immediate task at hand. Meanwhile, the navigator takes a higher-level view, thinking about the overall design, considering edge cases, and watching for bugs or potential improvements. This division of responsibilities results in code that is carefully considered at both the tactical and strategic levels.
Compelling Benefits of Pair Programming
At first glance, putting two programmers on the same task might seem inefficient. Won‘t it take twice as long? Isn‘t it a waste of resources? Surprisingly, studies have consistently shown that pair programming delivers better results in less time. Let‘s examine some of the key benefits.
1. Fewer defects and higher quality code
One of the most measurable benefits of pair programming is improved code quality. A meta-analysis of several studies found that pair programming produced code with 15% fewer defects compared to solo programming[^1]. The immediate feedback and review provided by the navigator catches bugs early before they have a chance to compound.
Pairing also keeps developers focused and on-task. It‘s harder for your attention to drift to email or social media when someone else is relying on you. This increased focus and accountability results in tighter, more elegant code with fewer extraneous distractions.
2. Knowledge sharing and skill development
Pair programming is an incredibly effective way for developers to learn from each other. Working side-by-side with a partner exposes you to new ideas, tools, and techniques that broaden your abilities as a programmer.
Each developer brings a different set of experiences and specialized knowledge to the pairing session. By working together, both programmers benefit from each other‘s unique strengths and insights. In a 2015 survey of professional developers, 90% of respondents reported that pair programming helped them learn new technologies and skills[^2].
Pairing also hones your ability to clearly articulate your thought process and explain complex technical concepts. Being able to communicate your ideas is a critical skill for advancing your career as a developer.
3. Fewer distractions and greater efficiency
When you pair program, you‘re inherently more focused and less prone to distractions. Maintaining the flow of communication and collaboration with your partner naturally keeps you engaged and on-task.
Research bears this out: one study found that pairing reduced the number of long breaks developers took by 78% and resulted in 84% fewer short breaks[^3]. By minimizing distractions, pair programming helps you make steady, efficient progress on challenging problems.
As a result, many tech industry leaders have embraced pair programming as a core practice:
- Pivotal reports that pair programming has been a key factor in delivering reliable software on-time for clients like BMW, Comcast, and Bank of America^4
- Thoughtbot has found that projects using pair programming are 20% more likely to deliver on-budget and 11% more likely to deliver early compared to non-pairing projects^5
- At Square, engineering manager Erin Swenson-Healey reports that "every new engineer, whether a recent college grad or a 10-year veteran, participates in our pair programming onboarding program. It‘s an incredibly effective way to ramp up on new tech."[^6]
Expert Perspectives on Pairing
Still skeptical about the value of pair programming? Let‘s hear from some experienced developers on why they find pairing so beneficial:
"Pair programming is like a tandem bike ride. You might be able to go faster alone, but you‘re less likely to make wrong turns or fall over when you‘ve got someone else with you. Plus it‘s a lot more fun!" – Lisa Smith, Senior Software Engineer
"I firmly believe that pairing has made me a better programmer. Having to vocalize my thinking and respond to my partner‘s questions forces me to be more rigorous. Our combined knowledge always produces higher-quality code." – Michael Thompson, Lead Developer
"The stereotypical ‘lone genius‘ programmer is a myth. In reality, the best developers are great communicators and collaborators. Pair programming trains you to be both." – Jessica Davis, Engineering Manager
Tips for Effective Pair Programming
Convinced and ready to give pair programming a try? Here are some tips to help you get the most out of your pairing sessions:
1. Be an active participant
Whether you‘re driving or navigating, stay engaged and communicate openly. If you‘re the driver, keep a running commentary on what you‘re doing and why. If you‘re navigating, don‘t hesitate to ask questions and make suggestions.
2. Take regular breaks
Pair programming is mentally taxing! Take frequent short breaks to recharge and avoid burnout. Many pairs find the pomodoro technique, alternating 25 minutes of focused work with 5 minute breaks, to be very effective.
3. Embrace "yes, and…" thinking
It‘s easy to get defensive when your partner questions your approach. Resist the urge to dig in your heels. Instead, keep an open mind, build on each other‘s ideas, and prioritize finding the best solution.
4. Be patient and respectful
Pairing puts you in close collaboration with another person for extended periods. Be considerate of your partner‘s needs and working style. If a conflict arises, address it calmly and professionally.
Remote Pair Programming: Tips and Tools
In today‘s era of globally-distributed teams, you may find yourself pair programming with a colleague on the other side of the world. While remote pairing presents some unique challenges, modern tools make it easier than ever to collaborate smoothly and effectively.
Here are some of the most popular tools for remote pair programming:
-
Tuple: This all-in-one pair programming app was designed specifically for remote collaboration. It includes high-quality video chat, low-latency remote control, and a shared code editor.
-
Visual Studio Code Live Share: This extension for the popular Visual Studio Code editor allows developers to share their workspace and collaboratively edit code in real-time.
-
tmate: tmate is a terminal sharing tool that enables developers to instantly share command-line access to their workspace. It‘s a simple, lightweight option for terminal-based workflows.
To get the most out of remote pairing, follow these best practices:
-
Invest in quality A/V equipment: Clear audio and video are essential for effective communication. Make sure you have a good headset and webcam.
-
Minimize background noise: Remote pairing partners can hear everything going on around you. Take calls in a quiet environment to avoid distractions.
-
Use a shared code editor: Tools like VS Code Live Share allow you to collaboratively edit the same files, making it easy to follow along with your partner‘s changes.
-
Agree on a pairing style: Discuss upfront how you‘ll approach the session. Will you strictly adhere to driver/navigator roles or take a more fluid approach?
-
Take extra care with communication: Without the benefit of in-person body language cues, it‘s especially important to communicate clearly and check for understanding frequently.
Go Forth and Pair!
Pair programming is an incredibly powerful technique for improving your skills and advancing your career as a developer. By collaborating closely with other programmers, you‘ll write better code, pick up new technical skills, and hone your ability to communicate complex ideas.
If you‘re new to pairing, start small with short sessions and gradually ramp up as you get more comfortable. Stay open-minded, communicate openly, and embrace the opportunities to teach and learn from your peers.
While pair programming can feel awkward and challenging at first, the long-term benefits are more than worth the initial discomfort. You might be surprised at how much more productive and enjoyable programming is when you‘re working through problems and learning together with a partner.
Here are some additional resources to help you get started with pair programming:
- Find a pairing partner on the CodeBuddies Slack community or the /r/ProgrammingBuddies subreddit
- Read "On Pair Programming" by Birgitta Böckeler and Nina Siessegger for a deeper dive into pairing techniques and best practices
- Practice pairing on coding exercises from LeetCode or HackerRank
- Watch experienced developers pair program in real-time on Twitch streams like Pair Programming with Us
No matter where you are in your programming journey, it‘s never too early or too late to add pair programming to your toolkit. So go forth, find a partner, and experience for yourself how pairing can accelerate your growth and open up new opportunities. Your future self (and your future teammates) will thank you!
[^1]: Hannay, J.E., et al. "The effectiveness of pair programming: A meta-analysis." Information and Software Technology 51.7 (2009): 1110-1122.[^2]: Kuttal, S.K., et al. "Perspectives on Pair Programming from Industry Professionals." 2015 IEEE/ACM 37th IEEE International Conference on Software Engineering. IEEE, 2015.
[^3]: Hulkko, H., and Abrahamsson P. "A multiple case study on the impact of pair programming on product quality." Proceedings of the 27th international conference on Software engineering. 2005. [^6]: Private correspondence with Erin Swenson-Healey