Pair Programming
- In Turkish
- eşli programlama
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
- Code ReviewVersion Control, p. 4A code review is the practice of having other developers check code changes before they are merged, to catch bugs, improve quality, and share knowledge.
- Test-Driven DevelopmentTesting & Quality, p. 34Test-driven development is a coding practice in which you write a failing test first, then write just enough code to pass it, and then clean up the design.
- AgileTeams & Process, p. 2Agile is an approach to software development that delivers working software in small, frequent increments and adjusts plans based on regular feedback.
- RefactoringSoftware Architecture, p. 33Refactoring is the process of restructuring existing code to make it cleaner and easier to maintain without changing what the code does from the outside.
- Pull RequestVersion Control, p. 32A pull request is a proposal to merge changes from one branch into another, giving teammates a place to review, discuss, and test the code before it is merged.
Spotted a mistake or something missing on this page?Suggest an edit