What Is Pair Programming & How Does It Work? | Datadog
What Is Pair Programming & How Does It Work?

Applications

Pair Programming Overview

Learn how pair programming can be used to improve outcomes in software development

What is pair programming?

Pair programming refers to a common practice in software development where two developers work on the same coding task at the same time. Traditionally, pair programmers worked behind a single computer, with one developer acting as “the driver” who controlled the keyboard and mouse, and the other developer acting as the “navigator” who offered suggestions. Today, teammates coding in tandem usually work remotely with the help of collaboration tools. But whether they are working together physically or virtually, pair programmers often find this technique allows them to be more productive and write higher-quality code because they are discussing, reviewing, and testing the code as it gets written.

What problems does pair programming solve?

Programming is a complex job, and it’s challenging to consistently create clean, efficient, and reliable code while working in isolation. It’s notable that the very first programmers—who worked by setting switches and wiring plugboards to program the original ENIAC computer—decided to work in pairs to improve their results. And for years afterwards, working in teams of two remained common.

The practice temporarily declined in popularity, however, when computers became smaller and more affordable, and businesses started putting a computer on every programmer’s desk. Working on their dedicated machines, software engineers were at first encouraged to work alone on individual tasks.

But programming tasks grew more challenging for solitary developers the more powerful that personal computers and software became. This is because the bar kept being raised for companies who were using code to improve decision-making, gain efficiencies, and stay competitive. Programmers, as a result, faced increasingly sophisticated and complex problems—the kinds of problems that were solved more reliably by working in tandem versus solo. Alongside these trends, pair programming began to make a comeback in the 1990s amid other programming reforms such as the rise of object-oriented software and agile software practices.

Today, software development is still constantly evolving and growing in complexity, as are codebases. Engineers need to stay up-to-date with the latest tools, languages, and techniques, and they need to make contributions that work within the context of sprawling applications. Under these difficult conditions, many developers find it as challenging as ever to individually produce software that meets the most cutting-edge quality standards in a reliable way.

What are the benefits of pair programming?

Pair programming naturally promotes communication between developers as they work together on tasks, encouraging them to verbalize their thoughts as they tackle challenges as a team. This communication, in turn, helps the engineers improve their understanding of the problems at hand. Working together on each task, paired teammates clarify their viewpoints, exchange ideas, share knowledge, and plan problem-solving strategies. They can also effectively focus on mutual objectives, which in turn fosters a sense of collective ownership and responsibility over the code.

Pair programming also enables developers with different coding styles and personalities to connect and learn from each other, making knowledge transfer a key benefit. Pairing therefore helps improve programming skills, all while encouraging teammates to also develop their interpersonal skills.

In terms of its more tangible programming benefits, pair programming tends to promote the creation of code that is more well-thought-out and organized. That means the code is easier for engineers to understand, which in turn facilitates identifying any potential bugs within that code and uncovering unintended behaviors—ultimately making the code easier to update and maintain. Similarly, pair programming also helps maintain consistency in coding guidelines. This has led some companies to skip official code reviews as a separate step because a code review is essentially conducted as the code is written.

While many agree that pair programming improves the reliability and quality of code, opinions differ on whether the practice also translates to faster delivery times. On the one hand, with two brains working on especially challenging problems, solutions tend to be found more efficiently. And by shortening workflows with the potential removal of code reviews, software delivery can be streamlined. On the other hand, some research has shown that pair programming allows code to be delivered approximately as quickly, but with fewer defects compared to the alternative of having engineers code alone.

What are the challenges of pair programming?

Although the original convention of having a “driver” and “navigator” seated behind one computer might suggest that one participant is more active than another, in reality, pair programming works best when both programmers remain actively involved in the process. When pair programming takes this traditional form—with the programmers sharing a single keyboard and monitor—the navigator needs to stay involved by providing ideas, looking up supporting information, and checking for errors as the driver is coding.

However, this older practice of sharing a computer is no longer widespread for pair programming. This method arose, after all, when programmers were co-located in one office and could easily share a physical computer, and before the times when business culture favored communication primarily through messaging apps. With the improvement of messaging tools and internet-based productivity applications, modern teams are increasingly distributed, especially since the COVID-19 pandemic—often making this original version of pair programming impractical to implement. The rise of remote work thus presents an important challenge for pair programming—as well as an opportunity: How can teams best reap the benefits of pair programming while remaining on separate computers, in separate geographical locations?

More specifically, remote teams who want to enjoy the benefits of pair programming need to find a way to enable participants to:

  1. Interact within the same shared screens. Screen sharing tools typically allow only one person to type, and others to view.

  2. Achieve adequate screen quality when sharing windows and particularly IDEs.

  3. Share more than one window at the same time.

  4. Participate in screen sharing, talking, and coding at the same time without having to juggle multiple applications.

  5. Find tools with excellent audio/video quality that allow them to communicate in real-time.

What are the best tools for pair programming?

Modern pair programming for distributed teams relies on tools that provide the following features:

  1. Collaborative integrated development environment (IDE): Some tools let users invite other developers to collaborate directly within the IDE. This works well when users collaborate only on code and have the same development environments.

  2. Video conferencing with shared remote control: Some tools enable users to share their windows and desktops and grant remote control. Most of the time, only one user can share their screen and the process to switch between driver and navigator is fairly complicated. Those solutions are often primarily optimized for video chats and webcam feeds, rather than high-frequency collaboration on high-resolution screen shares and crisp code.

  3. Multi-user pair programming: The best tools enable multiple users to share screens at the same time, and allow all participants to make alterations in each other’s IDE, terminal, or other shared app as if they were working side by side or on the same machine. No matter how many users are on a call, or how many screens are being shared, the quality of screen-sharing shouldn’t degrade, which is important when looking at a high volume of tiny lines of code.

CoScreen by Datadog provides all of these pair programming features in a single product, allowing two or more engineers to share and interact with many screens simultaneously, even in different applications, all while providing high-quality video conferencing functionality. For more information about CoScreen, see the Datadog documentation.

Related Content

Learn about Datadog at your own pace with these on-demand resources.

products/coscreen/session_replay_childpage_hero_mobile

product

CoScreen

/blog/pair-programming-coscreen-datadog/coscreen-v5-hero

BLOG

More efficient pair programming with Datadog CoScreen

/blog/collaborative-screen-sharing-with-datadog-coscreen/coscreen-hero

BLOG

Leverage collaborative screen sharing with Datadog CoScreen