Learning To Code

Better Together: Why Pair Programming Can Keep You on Track

Many hands make light work.

Flatiron School / 20 September 2017
SHARE:

This post was originally published on July 21, 2015.

It’s a contentious debate in the developer community: is pair programming worth it?

When it comes to your shining accomplishments, it’s likely you’ve done much of your best work alone, away from distractions. More often than not, those breakthrough moments arrive at a time of respite, solitude, or even sheer burst of energy.

But every once and a while, having another programmer at your side can keep you from getting distracted by Buzzfeed’s latest clickbait or from making an easily preventable mistake. So what does that mean for your work? A higher level of accuracy and objectively better written code, which keeps projects on track.

dogs
Here are four reasons why programming in pairs will enhance your game (and mean less cleaning up messes later):

It’s a great way to teach code

When people first embark on the journey of learning to code, there are a lot of roadblocks in the way. It can be frustrating, and without any type of support network, it may feel tempting for those still learning the ins and outs of languages like Ruby or JavaScript to throw up their hands and quit. This is where the support and encouragement of a partner can make a big difference, especially because they may be able to fill in gaps of knowledge to keep the project going at a forward momentum.

For beginners who have a tenuous grasp on material, pairing with another person on the same level helps reinforce what they just learned together. And it’s not just for newbies, either — it works for all levels of learning. For junior developers hoping to hone their craft, working with a senior developer who demonstrates quality techniques and habits may give them the needed tools to improve their work, and offers additional knowledge that otherwise wouldn’t have been available. In the short term, it may slow a senior dev down, but in the long run, it will help with the company’s overall knowledge and productivity.

Screen Shot 2015-07-21 at 11.03.08 AM

In sum, high morale + additional knowledge = a lot brighter road ahead.

It strengthens design

In the context of code, design is a pivotal factor when it comes to the quality of the finished product, especially when it will inevitably need to be re-purposed or changed. A rogue programmer who decides not to consult with others or really map out the purpose of their design may make everything more complicated as the project progresses.

clinteastwood

Save the cowboy antics for another time.

So when it comes to design, coding in pairs doesn’t necessarily mean writing every keystroke together, line by line. Start by discussing with a fellow teammate what will be the most efficient way to create a flexible and malleable design. After that, you can break off on your own and write that brilliant code with a plan in mind.

It creates checks and balances

Let’s boil this down to some objective facts: the end defect content is statistically lower when partners pair up and participate in continuous code reviews. That’s because you’re human, and prone to mistakes (about 100 defects per 1,000 lines of code, in fact). Studies have shown that with a programming collaborator, you’ll have 15% less defects, and believe in humanity 78% more than usual. (OK, the humanity bit is made up the rest of it is all true!)

Whether you’re deciding to use pair coding just in the initial stages or as a full-blown activity to sit down and work out together, coding in pairs helps create checks and balances to correct the inevitability of human error. It also helps you focus on one activity instead of multi-tasking with a lower success rate. If one person can keep an eye on the conceptual ideas, another can make sure that curly brace is where it’s supposed to be. At the end of the day, pair programming helps to correct those mistakes before they get lost in thousands of lines of code.

coffee

All the cups of coffee in the world are not going to correct the fact that you’re tired and forgot a semicolon.

It contributes to a community-oriented culture

Working in code can sometimes be an isolating endeavor, and it’s easy to get trapped behind the mesmerizing glow of that screen. Committing to a project with a partner will help you understand your thought process as you speak it out loud, as well as get insight into your partner’s thoughts. It also enhances team dynamics and gives better information flow, which means higher quality projects in the end.

Pair programming contributes to a selfless development culture.

Additionally, team members working on projects together end up with multiple understandings of each part of the system, so that more people can go in and work on the code later as needed changes arise. And, as one of Flatiron’s own junior developers put it, “[Pair programming] contributes to a selfless development culture.” It encourages people to help each other become better programmers, work collaboratively, and not give up when the going gets rough.

Companies that implement pair programming — at the very least, on occasion — have better team dynamics and report they enjoy their work more. It puts a human face on all that code. Because explaining your process to a rubber duck can only help you so much.

rubberduck


Ready to experience learning to code alongside a community? Get started in our free Bootcamp Prep course!

The #BacktoCode Check-In: Week 3 Previous Post The #BacktoCode Check-In: Week 4 Next Post