Pair Programming

November 19, 2023

đŸ§‘â€đŸ€â€đŸ§‘ What is pair programming?

Pair programming is a collaborative endeavour in which two people work together on a single coding task. Typically, the person writing the code is called the driver, and the one reviewing the code is the navigator, and they’ll swap roles a few times throughout the session. The aim is to foster an environment of active shared participation between both individuals as they each adopt a different perspective to achieve a common programming goal.

Two small brown mice sitting on a branch

Photo by Belinda Fewings on Unsplash

đŸ€” Why would it be used?

Heavily associated with Extreme Programming (XP), an Agile methodology, one of the promoted benefits of pair programming is that it aims to ensure effective teamwork with different, but equally important, scopes of responsibility for each developer. While the driver is focused on writing the actual code to accomplish the more granular task at hand, they’ll be thinking out loud as they do. The navigator will maintain a higher-level view of the programming direction, consider options for the next steps, and keep an eye out for the risk of bugs being introduced. When well-executed, it can be a great opportunity for each developer to use their technical as well as soft communication skills to write code with better architecture and lower risk of bugs than what either of them may have achieved in isolation.

“Betty Snyder and I, from the beginning, were a pair. And I believe that the best programs and designs are done by pairs, because you can criticise each other, and find each other’s errors, and use the best ideas.”
— Jean Bartik, one of the very first programmers

đŸ€č‍♀ Is there only one way to pair program?

There are other pairing techniques besides the driver/navigator roles. Adapting a more unstructured style, two developers can pair up to tackle a task together, even occasionally summoning a third, often more experienced developer for input and guidance on major decisions, or to help get them unstuck if they’ve hit a progress blocker.

Three meerkats on sand during daytime

Photo by DuĆĄan veverkolog on Unsplash

Another technique, called Mob (or Ensemble) Programming, is popular for hackathons or TDD (Test-Driven-Development) code retreats, where a larger group of developers collaborate on a task, allowing for a larger variety of insights and experiences. Mob events can often feel more socially casual, since with more people on the team, there can be a wider comfort range for participants who may be somewhat less familiar with the coding language being used but who still want to take part to further their own learning.

Insights from the Cucumber team, the people behind the acceptance-testing tool for Agile teams, have highlighted how mob programming has empowered their development team to be more inclusive. Mobbing has given their business the broadest reach when recruiting new members, enabling them to enjoy and leverage all the other well-documented benefits that more diverse teams are proven to offer.

Teaming up on a rotational basis can also be an effective tool to smooth out the new hire onboarding process. By giving the new colleague a chance to meet with everyone on the team, they can be quickly given a great overall perspective on the tech stack used, as well as a variety of individual perspectives on the current state of the codebase. Every developer will have an opinion about the code’s current challenges and insight on why particular architecture and design choices were made. Every team will have their own dynamic to learn, and wisdom to share about what, if building the same thing today, they might prefer to do differently this time around.

On day one of the new job, without any of the necessary system or account permissions, a new hire can help their new team during pairing sessions by spotting typos, respectfully querying the status quo from a fresh new learner’s perspective, and — of course, Googling to help research various code refinement options. If the existing documentation doesn’t match what’s seen in the code, the newest colleague is well-placed to update the docs. Every new hire gets the gift of time for their first few weeks, and taking the opportunity to dive right in and start contributing can often be a welcome reprieve from the less-exciting (but still vitally important) mandatory cybersecurity, financial crime prevention, and other legal and regulatory training courses that most businesses require new joiners to complete during the first few weeks of their tenure.

đŸ€” Are there downsides to pair programming?

The idea of humans working together is not a new concept, so, unsurprisingly, collective efforts in the world of software development share many of the same advantages and limitations as other scenarios involving any kind of collaborative work. Not every situation will warrant the time and effort involved. Not every business will see value in pairing for knowledge sharing and exchanging ideas with the potential for a less speedy deployment cycle. Not every developer will feel enthusiastic about taking part in a pair session, on that specific day, at that particular time.

Brown and white cat in shallow focus shot

Photo by 悅甬 捎 on Unsplash

As well, pairing can disrupt the flow of deep solo concentration. Developers can’t listen to music while they pair. Meetings, online or in person, even only between two people, can sometimes be mentally exhausting. Also worth a quick mention is the entire range of complexities involved when working with someone who has a different personality, level of experience, preferred communication style, or willingness to even partner up in the first place. There are likely as many arguments against pairing as there are in favour of it.

đŸ€·â€â™€ What’s the solution?

If there was a one-approach-fits-all answer to the challenges involved with pair programming, it’d probably already exist in highly monetized form — and as much as this developer would love to change the world with a free open-source solution, you won’t find one in this post.

However, if we agree that most enterprise-level software projects will eventually grow in scale beyond one person’s time availability or current skill set, you’re likely to encounter the requirement for some type of group effort throughout your development career. If you enjoy teamwork, the good news is that all the skills acquired from other aspects of your life will transfer very well into the realm of pair programming.

Alternatively, if you haven’t enjoyed any of the collaborative work you’ve done elsewhere, the good news is that you’ll be able to leverage all your adaptive skills to ensure teamwork is something you can do effectively when the situation doesn’t allow for your personal preference to opt out.

“Living life by going with the flow
”
— Gudetama, the famous lazy egg

When faced with numerous potential variables, many of which are outside of your control, it’s a good idea to remain flexible, adjusting to the given scenario in a way that still enables you to stay true to yourself.

đŸ‘©â€đŸ« What worked well for this new developer

Whether you enjoy teamwork or only endure it, there are multiple techniques you can use to tailor your approach to collaborative events as you encounter them along your career journey.

Be friendly and welcoming.
Be mindful of how much space you take up in conversations.
Be respectful of others by choosing words and actions with care.
Ask questions.
Take care of your body.
— The Coders’ Code, from Canada Learning Code

đŸ‘©â€đŸ’» Some observations from my own group collaboration experiences:

“Competition happens at the bottom.
The people at the top are collaborating.”
 — original source unknown


References & Additional Resources to Explore:



Tags: coding, learning, collaboration

← Back home