Adopt Pair Programming

Introduction

Pair programming is a collaborative technique where code is created by two people working together at a single computer. The result is higher quality code, faster time to production, and the opportunity to build deeper team dynamics.

Why is this important?

You’ve probably heard the saying “two heads are better than one,” and pair programming provides the proof. The benefits are numerous to both the quality of the code and the interpersonal relationships of the team.

Background Information

Pair programming styles

  • The Driver-Navigator style is when one person drives the keyboard while the other person navigates as an observer. The driver is focused on completing a small goal or task. The navigator provides real-time reviews, shares ideas, and provides direction. The navigator is also thinking more strategically about what comes next and is able to identify bugs and obstacles. The pair should change roles every 15 minutes.
  • The Ping Pong style is ideal for clearly defined tasks that can be implemented right away. Ping writes a failing test. Pong writes the implementation to make it pass. At this point, the pair can refactor the code together. After one iteration, the pair changes roles.
  • The Strong-Style Pairing is used for knowledge transfer. The navigator is the more experienced of the pair. The driver is often a novice. Both parties must actively participate. The risk is that the more experienced of the pair will do all the thinking and all the driving of the keyboard, leaving the novice to observe. The pair does not change roles in this pairing.
  • The Unstructured Pairing style occurs when two people in a well-matched pair progress to a free-flowing approach. When done well, the pair are able to work even faster. Consider this advanced pair programming. The pair intuitively know the best time to change roles.
  • Remote Pair Programming has all the benefits of pair programming. It is a good way to foster and maintain relationships.

It’s not mentoring

Both people work together as equals, even when one has more experience. Even in the Strong-Style Pairing, the ideas generated by the more experienced person must go through the hands of the driver to get the full benefit of pair programming.

Persistence pays off

Pair programming can feel awkward until both people begin to experience the benefits. A team operating in an environment of psychological safety with an appreciation for the power of collaboration is poised to reap the rewards of pair programming.

Outcomes and Risks

What good looks like

Pair programming promotes high-quality, maintainable code in a sustainable way. Teams who successfully adopt pair programming benefit from:

  • Increased quality of code
  • Faster time to delivery
  • Knowledge sharing amongst the team
  • More creative problem-solving
  • Deeper insight into problems and solutions
  • Increased focus on specific tasks
  • Continual code review
  • Increased team productivity Pair programming is like riding a bike. It may be frightening in the beginning, but once mastered through practice, it’s the most natural thing you do.

Potential issues

Pair programming is a social skill that takes practice to master. The benefits are enormous, but it does not have widespread adoption in the industry. Some of the reasons include:

  • A lack of engagement brought about by power dynamics, especially when there’s an assumption of leader and follower roles in the pairing. It’s essential to establish that both people are equally important to the success of pair programming.
  • Resistance to the practice of pair programming due to the misconception that it’s a slower way to work
  • Management pushback because of a belief that two people working on the same task doubles the time and effort it takes to complete a task.
  • Pairing requires vulnerability, which can be uncomfortable for people who gauge success or failure based on how much knowledge they have. You’ve probably heard the saying “two heads are better than one,” and pair programming provides the proof. The benefits are numerous to both the quality of the code and the interpersonal relationships of the team.

Action Plan

1. Plan

Schedule a team discussion to introduce pairing as a positive activity. Ensure each person understands the benefits, both personal and to the team. Make sure everyone understands what is expected of them and provide an opportunity to raise any concerns they may have.

Ensure the pairs are good matches, especially in the beginning. As your internal competency grows, everyone benefits from pairing with new people. Pair programming is most effective when the pair complements each other in knowledge, experience, or a diverse perspective.

Do not overload the team with so many tasks they feel they don’t have the time to pair..

Don’t expect pairs to work together all day, every day. Pair programming is intense and can be exhausting. Overdoing it can lead to reduced enthusiasm for the practice.

2. Identify stories

Select stories to pair on:

  • Ensure the pair has suitable skills to complete the task.
  • Assign a single owner who is responsible for completion.
  • Start with easy wins so the pair can learn how pair programming works best for them.

3. Discover

There is no right way to pair program. Pairs should have time to try different styles, including:

  • Driver-Navigator
  • Ping Pong
  • Strong-Style Pairing

Unstructured PairingConsider Remote Pair Programming if you have a distributed team. If pair programming is not working – or not working well – explore the possibility of finding a new pairing partner or try a different style..

4. Schedule

Pairing requires scheduling and calendar coordination. For remote teams, you may have to consider working across time zones. The World Clock Meeting Planner is a good tool to navigate time zones.

Tips for scheduling:

Decide with your pairing partner what days to pair.

Establish a clear goal when scheduling a pairing session that you both want to achieve. If you achieve your goal early, end the session. If you do not achieve your goal, schedule a follow up session before you part.

Agree to a time limit for a pair programming session.

Include breaks to ensure time for phone calls, emails, and general unwinding after a heavy programming session.

Set a maximum time for each rotation, to ensure equal time navigating and driving. The Pomodoro Technique is well-suited to pair programming and can be a good way to establish a productive schedule.

5. Review

Take 5-10 minutes at the end of each pairing session to debrief and discuss both the code and the process. Reflect on what you would change for next time or where you can make improvements.

Keep track of when pairing sessions occur and who is involved to monitor uptake and overall effectiveness.

References