One of the topics that came up the most in our podcast this year is pair programming.
Pairing is one of the core practices advocated by Kent in extreme programming, and Farhan told us it is widely adopted in Shopify, too. It was also recommended by Greg, and DHH said it inspired how he uses AI these days.
This shouldnโt be surprising โ all studies about pairing (which go back to the early 2000s) report overwhelming benefits across happiness, growth, code quality, and even overall productivity.
Yet, it is still kinda surprising, in 2024, to hear about teams and people pairing regularly.
Why is that?
Farhan argues that pair programming is the underhanded free throw of engineering. Underhanded free throws have been proven to be better than normal free throws at everything except one thing: they look stupid.
And pair programming does look stupid, to everybody:
๐ผย To managers, it feels like a wasteย โ it's two devs working on the same code, when they could be doing two separate things.
๐จย To developers, it feels uncomfortableย โ social interaction is draining. And what about the sacredย state of flow?
Nevertheless, several extremely successful companies pairย regularly, orย most of the time, or evenย all the time. In some cases, they have been doing so forย decades, and they loudly advocate the case for it.
So, this article is my best attempt to demystify pair programming and tell you everything you should know about it:
If you pair already, this is the piece you will send to your skeptical friends.
If you donโt pair, this is the piece that will make you a convert, or will at least make you try.
Here is the agenda:
๐ย Why you should pair program โ letโs talk about productivity, knowledge, happiness, and soft skills.
๐ How to pair program โ the most popular techniques and when to use them.
โฑ๏ธ How to plan for pair programming โ what goes into a session and how to make it successful.
๐จย Tools for pair programming โ please donโt pair on Zoom. A short list of the best tools to elevate the pairing experience.
โ FAQs โ a greatest hits of the most frequent questions I get about this, including how to allocate resources, whether should managers pair, should you pair remotely, and more.
๐ย Resources โ further guides, articles, and papers to learn more.
Letโs dive in!
๐ย Why you should pair program
Pair programming is consistently adopted by some of the best engineering teams in the world. The degree of adoption varies: from those who pair regularly, like GitLab,ย GitHub,ย Atlassian, and Shopify, to those who pair most of the time, like Thoughtworks andย Pivotal.
You will notice that companies that pair also usually write about it (see links above). They advocate for it. They act like they uncovered a secret and want everybody to know.
The benefits reported by these companies can be organized in four main categories:
๐โโ๏ธย Productivity
๐ย Knowledge Sharing
โค๏ธย Happiness
๐ฝย Soft skills
Some of these are to be expected, while others are wildly counterintuitive. Let's see them one by one.
1) Productivity ๐โโ๏ธ
The metric for successful programming is not the number of lines of code, but the ability to solve a problem in a maintainable, and understandable way for the long term.
โ โIf you have two engineers on one computer, wonโt they type half as much code?โ
โ โI hope even less than thatโFarhan Thawar, VP of Engineering at Shopify
But still, letโs talk about output. Various studies [1, 2] suggest that the raw output of a programming pair, in terms of tasks they are able to accomplish, is only 15% smaller than that of two independent developers.
This is somewhat surprising. Why only 15%? For two main reasons:
Less distractionsย โ two people are less likely to get distracted than one. That short trip to Instagram doesn't look all that appealing when there is someone else by your side. Also, if you lose focus or get interrupted, the other can remain in a flow state, and quickly bring you back in.
More awarenessย โ when working for hours on a problem, you might lose perspective of the main task. Remember that time you spent all afternoon on a bug and then fixed it in 10 minutes the morning after? Thatโs when the โstate of flowโ gets toxic and turns into tunnel vision. This doesnโt happen in a team of two.
That said, this 15% gap is easily repaid down the line by three main factors:
No code reviewsย โ the code you produce is automatically reviewed by your peer. No blocking PRs to stop you from shipping. Also, this kind of review is way better than your regular PR.
Less WIP โ assigning more people to tasks means there are automatically less tasks in progress at any given time. Less tasks in progress equals less context switch, less batching, more focus, and better output.
More quality โ pair programming consistently leads to higher code quality. Two people bring in better problem solving, which leads toย better design. This in turn brings in less bugs, less bad abstractions, and less time spent on maintenance over time.
2) Knowledge Sharing ๐
Pair programming is a phenomenal knowledge sharing device. There are at least three use cases for which such sharing is valuable:


