How to Take Your Pair Programming Skills to the Next Level
The research is in – pair programming is awesome. At the cost of about a 15% increase in development time, pairing produces code with fewer errors, and even makes us happier at work. I’m here to help you take your pair programming skills to the next level.
Seriously, though: those claims are supported by actual research. Download the respective PDFs here: The Effectiveness of Pair Programming: A Meta-Analysis, The Collaborative Software Process, and Strengthening the Case for Pair-Programming.
But if you take a cross-section of developers, you’ll find some very mixed opinions about pairing. Some devs hate it. Some devs write blog posts about how great it is.
Developing pair programming skills means handling the learning curve
Why the divide? It’s easy to hand-wave away by muttering something something soft skills and leave it at that – which is exactly why I dislike the term “soft skills.” It’s too often used in a nebulous way to indicate something that’s the opposite of hard, aka technical, skills.
In reality, the two are highly complementary skill sets. It’s hard to collaborate with someone without learning from them, which is a really effective way to ramp up your technical skills. Done right, it becomes a positive feedback loop where the development of soft skills reinforces the development of technical skills and vice versa.
But it’s true that there’s a learning curve to pairing. Think of picking up an unfamiliar musical instrument for the first time: at first it’s not much fun, as you fumble over fingerings and pick your way through unfamiliar notation, but it rapidly becomes more rewarding as you get comfortable with the basics.
So with that in mind, think of these tips & techniques as ways to help get over the discomfort of that initial curve and into a place where you can enjoy the benefits of pairing.
Describe what you’re doing
If you’re typing silently while your pair sits and watches… well, you’re both probably not getting that much out of the session. Try to narrate your approach aloud as you code, so your pair can jump in with questions or comments.
This is not something that’s intuitive to most people, so it’s helpful to practice on your own (at the risk of looking like the maniac arguing with their computer in a coffee shop).
You may have heard of this technique in the context of improv comedy, but it’s also a useful framework for most collaborative, idea-based work. Another way to say this is, don’t shoot down ideas prematurely.
If the first thing you do every time you hear an idea is to start listing its flaws, the energy of the session will drop. Instead, try to extend the thought or add further information. If it’s a bad idea, that’ll be clear soon enough; you might find that it still nudges you towards the solution.
Restate the problem
When you disagree with someone over how to approach a problem, it can start to feel like you’re talking about different things entirely. Pause, and make sure you agree on what the problem actually is. This hits a reset button so you can approach the disagreement in a more constructive way.
Pseudocode all the things
If you’re driving, it’s easy to forget that it’s harder to read code than it is to write it. One way to address this is by putting the code in a form that’s easier to read. Pseudocoding out a solution before starting to implement it lets you both examine it from a high level, where you’re better positioned to spot potential pitfalls.
Choose the right problem
Not all problems are well suited to pairing. High-level, complex problems are great for collaboration; lower-level, detail-oriented tasks, not so much. This can help you figure out when to end a pairing session and split off to work separately.
Practice regular check-ins
It’s easy to get caught up in the code and forget about our weak human needs like food and water and rest, but for some reason, people don’t tend to produce great code when they’re exhausted and dehydrated. Asking your pairing partner how they’re feeling once in a while helps keep you both going by making sure you take breaks and switch roles as needed.
Once you’re ready to wade in further, check out Chelsea Troy’s great series on advanced pair programming. And happy pairing!