The Latest text

Pairing Roles - Driver & Navigator

Pair programming is a coding technique where 2 people work on the same computer and the same bit of code at the same time. There are many different ways to pair program, but one of the most common strategies is referred to as Driver/Navigator. During our Code Review & Pairing events, we find the Driver/Navigator pairing strategy really valuable as a mentorship and learning tool.

We like to start every few events reviewing some basic guidelines for the Driver and Navigator roles so everyone can have a successful pairing session. It’s important to remember that not everyone has experience pair programming, and this may be someone’s first time coding in this way.

We’ve outlined our guidelines as they fit our event structure, but they are transferrable to any pairing relationship you may have.

Driver

The Driver role is the person who owns the computer, mouse, and keyboard. This person is physically writing the code. At our events, we prefer our Mentees to be the Drivers. Learning by doing reinforces understanding and improves retention of information. It is one of the best ways to learn complex topics.

When driving, it’s important to remember to think out loud. Your pair can’t read your mind so help them follow along by explaining what you’re doing. Make sure to comment on what you’re going to try, why you think something worked, or even why you decided against an approach.

And while it’s important to talk through your thought process, it is equally important to listen to your Navigator’s suggestions. During the pairing session, the Navigator will be thinking big picture as well as paying attention to typos and syntax. Make sure that you listen to understand and ask clarifying questions if you don’t understand something the Navigator says.

The Navigator is not responsible for physically writing the code, but guides the session along. The Navigator should help the Driver be able to explain their thought process. Ask the Driver to describe what they’re trying to do, why they made that decision, and how they’ve already tried approaching the problem as well as future ideas they have to solve the problem. Be a rubber ducky and help coach the Driver to think out loud.

While you’re navigating, you’ll be making big picture suggestions about what code to write. Make sure to clearly communicate your ideas. Don’t be afraid to whiteboard or draw pictures on scratch paper. When describing your idea, make sure you articulate the “why” behind your chosen solution.

The Navigator is also responsible for mini, ongoing code reviews during the pairing session. Help check for syntax and typos as the Driver focuses on the meat of the code. It is also helpful for the Navigator to keep track of high level tasks and issues as they come up to be implemented later. This prevents the current pairing session from being derailed from additional features, bug fixes, or refactors.

Both

While pairing, it is both pairs responsibility to be respectful and courteous. During a pairing session, the Driver and Navigator have shared goals and should be working together to achieve those goals. Make sure to always ask before taking the keyboard or mouse. It may seem small, but this one act of respect can dramatically shape the positive outcome of a pairing session.

Be sure to be conscious of you and your pair’s differing work styles. Some people are more experimental while other are deliberate. Some are verbal while others are visual. Don’t be afraid to try other styles of working and communicating and find what works best for you and your pair.

And finally, communication is key. For a pairing session to be successful, each pair needs to be vocal and check-in with their pair regularly for understanding and clarification. Practice makes perfect, so make sure that you are always putting effort to communicate your thoughts and the reasoning behind your decisions during a pairing session.