# Pair Programming

A collaborative practice in which two developers work on the same problem together, continuously reviewing and shaping the code.

- Type: practice
- Domain: Engineering & architecture
- Level: Foundational
- Last reviewed: 2026-09-22
- Original: [Soroush’s Product Wiki](<https://wiki.soroush.uk/topic/pair-programming/>)

## What it means

Pair programming places two developers at one active workstation or shared development session. One person, often called the driver, handles the immediate mechanics of editing and running code. The other, often called the navigator, considers intent, design, risks, and next steps. Both remain engaged and exchange roles regularly; it is joint development rather than one person coding while another passively observes.

## Why it matters

Pairing shortens the distance between proposing an idea and receiving review. It can spread system knowledge, reveal assumptions, support onboarding, and help developers solve unfamiliar or difficult problems. The continuous conversation may improve design decisions and reduce handoff loss, although outcomes depend on the people, task, and working conditions.

## When to use it

Use pairing for complex changes, incident diagnosis, risky code, unfamiliar areas, onboarding, or work where rapid shared understanding is valuable. It can be in person or remote with suitable tools. Not every routine task requires two people, and sustained pairing should include breaks and allow participants to opt out or rotate.

## How it works

1. Agree on the problem, a near-term goal, and how the pair will communicate and rotate.
2. Set up a shared environment in which both participants can see, discuss, and control the work.
3. Let the driver implement the next small step while explaining decisions and uncertainties.
4. Let the navigator review continuously, consider broader consequences, and suggest experiments rather than dictate keystrokes.
5. Switch roles frequently enough to preserve participation and shared ownership.
6. Pause to test, summarize learning, and decide whether continued pairing remains worthwhile.

## A practical example

A new engineer pairs with a service maintainer to add an idempotency key. The newcomer drives while the maintainer explains failure modes and asks questions about duplicate requests. They alternate after writing each test, discover an undocumented retry path, and leave both the implementation and system documentation stronger.

## Where it breaks

Pairing consumes two people's attention at once and can be exhausting when used without breaks. Skill, power, communication style, accessibility needs, time zones, and tool latency affect whether participation is equitable. It can also spread a mistaken assumption quickly, so pairs still need tests, external review for high-risk changes, and independent thinking.

## Common mistakes

- Allowing the more experienced participant to keep control and turn the session into observation.
- Pairing continuously without breaks, rotation, or attention to cognitive fatigue.
- Using pairing as surveillance or as a substitute for supportive onboarding.
- Assuming two participants eliminate the need for automated verification.

## Visualization

[View the visualization on the website](<https://wiki.soroush.uk/topic/pair-programming/#visualization-pair-programming>)

## Sources

1. [Pair Programming: Does It Really Work?](<https://www.agilealliance.org/glossary/pair-programming>) — Agile Alliance · Professional practice guide
2. [Pair Programming vs. Mob Programming](<https://agilealliance.org/pair-programming-versus-mob-programming>) — Agile Alliance · Professional comparison guide

## Related topics

- [Code Review](<https://wiki.soroush.uk/topic/code-review/>)
- [Mob Programming](<https://wiki.soroush.uk/topic/mob-programming/>)
- [Test-Driven Development](<https://wiki.soroush.uk/topic/test-driven-development/>)
