DEV Community

Cover image for What is Pair Programming?
Frank Font
Frank Font

Posted on

What is Pair Programming?

How would you define pair programming? I'm not looking for a textbook explanation. I'm looking for a "this is how I do it and it works for me" explanation.

Someone asked me recently and I did not have a ready answer. I know when it works, not how to describe the recipe in a sound bite.

Really, I don't have a short answer to how it is done right.

Maybe you do? If so, please share your thoughts here.

Top comments (2)

Collapse
 
ballpointcarrot profile image
Christopher Kruse

Pair Programming has a lot of facets, and they all sum up to provide the full experience.

An extra pair of eyes. Having another programmer looking at the same codebase at the same time can help spot things that you may miss while you're working. This can be as trivial as pointing out missed syntax issues or typos in identifiers, or wider structural and architectural issues. I've experienced this in the past, where I get so laser-focused on addressing the problem in front of me, that I start to lose the bigger sense of the problem I'm solving. There's always more than one available solution to a problem, and sometimes having another person who can say, "Hey, this approach doesn't seem to fit" can help save a lot of wasted time.

A social contract. I get easily distracted by the multitude of distractions available to me (phone dings, Twitter feed updates, boredom sets in and I start to doomscroll); having a second person helps to pressure me to keep focused on the task at hand, and save the distractions for later.

Human interaction while dealing with The Machine. Part of what makes pairing fun is how you interact with the person you have pairing with you. I've seen it treated differently by different people; some will gamify it by saying "we hit point x, then swap, until we hit point y, and swap back." These can be fun because you're leveraging the competitive aspect of a personal interaction. Others have bonding times over particularly tough problems, where you can look off from the proverbial summit of the mountain, and look back on what you've been able to accomplish.

Overall, I think it's just injecting a little more humanity into the process of coding.

Collapse
 
frankfont profile image
Frank Font

Love your answer Christopher. I recognize every one of of the benefits you listed. Nicely organized.

Injecting humanity into the process can be done in a way that makes the outcome better than what one individual would have produced -- or sometimes -- creates a setting where people can produce more without burning out.