The magic of pair programming

April 11, 2024

I've been pair programming for a long while let me tell you, my pairing sessions are the highlight of my work week. I pair several times a week, typically for 90-120 minutes at a time, and I find the benefits are well worth the time investment. At this point I've spent thousands of hours pairing and I hope to influence you to give it a shot!

What does pair programming look like?

There are many styles of pairing, but here's mine: we typically chat a bit, catch up if needed, and then take a couple minutes to create a menu of possible pairing tasks. These tasks are just what's on your plate at the moment - nothing exotic, not meant to impress, but just day to day coding work. After we lay out all of the possibilities we pick the one that will be most interesting or useful, and hop right in. I try to pick things that I know I could use a second opinion on, or that would be fun to share with another developer. If possible, I avoid tedious or mindless work that doesn't really need discussion or thought.

One person starts "driving" - sharing their screen and do the bulk of the work. I find that most of the time is spent talking, not typing - discussing solutions and exploring ideas together. We work the first task to completion, then switch drivers and move on to the next task. In a typical pairing session I expect to tackle 1-3 different tasks depending on complexity.

Don't leave a mess

One mistake I've made is to start a big refactor in a pairing session, only to run out of time and leave the driver with a mess to clean up after the session ends. I've learned to pick smaller tasks that can be completed in the session. That doesn't mean you can't work on big work - just pick achievable milestones within that larger scope.

How has pairing benefited me?

My solutions are always transformed during a pairing session. I come in with an idea of how I want to solve a problem, and leave with a new twist or a completely different implementation. Talking to another developer is the ultimate rubber ducking experience.

I love to teach and be taught - a pairing session is the perfect time to learn something practical. I often pick up language tips, tooling, and resources.

Pairing makes code review smoother in a couple of ways. First, since you helped write the code, you are very familiar with the following PR. And if you have a lot of questions about a gnarly PR, pairing is a great time to talk through what the other developer was thinking when they wrote it.

Finally, it's just fun. Even the most introverted developer needs to connect with others, and pairing is a great way to bond with your colleagues.

The pairing experiment: pairing with strangers

I typically pair with people on my team but I recently reached out to Joe Tannenbaum when he mentioned that he'd never paired before. We both took a chance on an internet stranger and have been having a blast pairing ever since. If you'd also like to try pairing with an internet stranger, my calendar is open - book a time and let's give it a try!

@joetannenbaum: Man, if you ever get a chance to pair with @benholmen, run don't walk. Such a blast.

I'd also encourage you to reach out to colleagues and internet friends and ask if they want to hang out for a bit and code together. Put yourself out there a bit and you'll be surprised by how much fun you have!

This blog is an experiment: less about education and more about documenting the oddities I've experienced while building web apps.

My hope is that you're here because of a random search and you're experiencing something I've had to deal with.

Popular Posts

Recent Posts

View all