Pair Programming Styles and When Each Works
Pair programming means two people working on the same code at the same time, usually sharing one screen or one editing session. It is often described as a single technique, but there are several distinct styles, and they suit different situations. Choosing the wrong one is a common reason that a pairing session feels slow or tiring.
This article describes the main styles, what each one is good for, and how to adjust when a session is not working.
The basic roles: driver and navigator
The classic arrangement gives each person a role. The driver has the keyboard and writes the code. The navigator watches, thinks ahead, spots mistakes and keeps the larger goal in mind. The two talk constantly, and they swap roles on a regular basis.
The value comes from splitting attention. The driver deals with syntax and the next few lines, while the navigator considers design, edge cases and what to do next. Neither role is passive. A navigator who goes quiet is no longer pairing, and a driver who silently types is working alone with an audience.
Ping pong
Ping pong pairing combines pair work with test driven development. One person writes a failing test. The other writes the code to make it pass, then writes the next failing test and hands the keyboard back. The roles alternate naturally with every cycle.
This style works well when:
- The problem is clear enough to describe as small tests.
- Both people want to practise test driven habits.
- You want to keep the keyboard moving fairly, so neither person dominates.
It is a poor fit for exploratory work, where you do not yet know what to test, because writing tests first forces decisions you cannot make yet.
Strong style
Strong style is a more disciplined version of driver and navigator. Its central rule is that an idea must go from the navigator's head into the computer through someone else's hands. The navigator decides what to build and tells the driver, who types it. The driver may ask questions and suggest alternatives, but the default is to trust and follow.
This is especially useful when one person knows the codebase or a technique and the other wants to learn it. The learner drives, so they actually practise, while the expert explains. It forces the expert to put thoughts into words, which often reveals gaps in their own understanding. The drawback is that it can feel awkward at first, and it needs patience from the navigator.
Unstructured or "pair and swap" pairing
Some pairs skip formal roles. They share a screen, both type when needed, and pass control freely. This feels natural between two experienced colleagues who already trust each other, and it works for quick debugging sessions. The risk is that one person gradually takes over, so check occasionally that both are contributing.
Mob programming
In mob programming, the whole team works on one task at one computer, with one person typing at a time and the others navigating. Typists rotate every few minutes, using a timer.
It suits situations where a decision benefits from many minds: a tricky design, a risky change, or onboarding a new teammate into a complex area. It also spreads knowledge across the team quickly and reduces handoffs and review delays. It is costly in person hours, so most teams use it for selected problems rather than daily work.
Remote pairing
Pairing across distance is workable with the right setup. Use a shared editing session or screen sharing with the ability to pass control, and keep a voice or video call open. A few practical points:
- Agree on a shared editor setup, or at least one person's configuration, so the environment is not a distraction.
- Take short breaks, since remote sessions tire people faster than sitting side by side.
- Use a timer for swaps, because it is harder to read body language to know when to switch.
- Make sure both people can see the code clearly, with text large enough to read.
Matching the style to the task
- Tricky bug. Driver and navigator, with the navigator reading logs and thinking about causes.
- New feature with clear requirements. Ping pong, or driver and navigator with frequent swaps.
- Teaching a new technique or codebase. Strong style, with the learner driving.
- Large design decision. Mob programming, or a short whiteboard session before pairing.
- Routine, repetitive change. Often better done solo, then reviewed.
Pairing is not required for every task. Simple, well understood work may be faster alone, and some people need quiet time to think. Use pairing where its benefits, such as knowledge sharing, fewer defects and faster feedback, outweigh the cost of two people on one problem.
Making sessions work
Set a goal at the start, for example "get this endpoint returning the right data." Agree on a length, commonly an hour or two, and take a break afterwards. Say what you are thinking out loud. Disagree about ideas rather than people, and try the other person's approach before dismissing it. If a pair of very different experience levels is working together, the less experienced person should still drive often, because watching is not the same as doing.
Frequently Asked Questions
Does pair programming double the cost of development?
Not exactly. Two people work on one task, so output per person falls, but the code often has fewer defects, needs less rework and is understood by two people. Whether it pays off depends on the task, so apply it selectively.
How long should a pairing session last?
Many teams find one to two hours is a sensible limit before a break, because sustained concentration and talking is tiring. Longer days of pairing work better when you swap partners and mix in solo time.
What if my partner and I work at different speeds?
Slow down the faster person, and explain your reasoning aloud. The goal is shared understanding, not speed. If the gap is large and persistent, try strong style so the less experienced person types and the other guides.