Skip to main content

Pair Programming

Updated 2 min read

Share this page

Send the link, quote the definition with a link back, or show it as a card on your own site.

https://softwaredictionary.org/terms/pair-programming

In short

Pair programming is an Agile technique in which two developers work together on the same code, with one typing while the other reviews and guides the work.

What is pair programming?

Pair programming is a practice in which two developers write code together on the same task, at the same time, using a single workstation or a shared editor. It became widely known as one of the core practices of Extreme Programming (XP) in the late 1990s. The goal is higher-quality code and shared knowledge, since two people understand every line that gets written.

In the classic driver-navigator style, the driver types the code and focuses on the details, while the navigator reviews each line, thinks about the bigger picture, and spots mistakes. Partners switch roles frequently, often every 15 to 30 minutes. In ping-pong pairing, which works well with test-driven development, one person writes a failing test and the other writes the code to make it pass. Remote pairs use screen sharing or collaborative editors to work the same way from different places.

Pair programming is especially useful for onboarding new team members, tackling tricky problems, and spreading knowledge so that no single person is the only one who understands part of the system. It is similar to a rally car with a driver and a co-driver: one controls the car moment to moment, while the other reads the route ahead and warns about upcoming turns.

Pair programming is often compared with code review. A code review happens after the code is written, usually asynchronously in a pull request, while pairing reviews the code continuously as it is written. Pairing costs two people's time for one task, but teams often find it reduces defects and rework. Mob programming, also called ensemble programming, extends the idea to a whole team working on one task together.

Key takeaways

  • Two developers work on the same code at the same time.
  • The driver writes the code, while the navigator reviews and plans ahead.
  • Partners switch roles regularly to stay engaged.
  • Pairing spreads knowledge and catches mistakes early.
  • It works remotely with screen sharing or collaborative editors.

Readers ask

Is pair programming less productive than working alone?

It uses two people for one task, so it can look slower, but research and team experience suggest it often produces fewer defects and less rework. Many teams pair on complex or risky work and work alone on simple tasks.

What are the driver and navigator roles?

The driver controls the keyboard and writes the code. The navigator watches, reviews each line, and thinks about the overall direction, and the two swap roles regularly.

Can AI coding assistants replace pair programming?

AI coding assistants are sometimes described as pair programmers because they suggest code as you type. They can speed up routine work, but they do not replace the shared understanding, mentoring, and design discussion that two people gain from pairing.

See also

Spotted a mistake or something missing on this page?Suggest an edit

Read a random page
Open today's review
Switch to the dark theme
Read this page in Türkçe

More

Settings