Pair programming is exhausting. The level of focus required takes more energy than working by yourself. Not to mention that your schedule, personal needs, and downtime are no longer under your control. For these reasons it’s best to use pair programming on a short-term basis to accomplish a specific goal. Its usage is similar to that of a Navy SEAL team deployed for black ops; performing a task with a specific objective that must be achieved in a limited window of time.
For a summary of the roles and responsibilities in Pair Programming, please visit this link.
1. Starting a New Project
A blank slate is a unique opportunity to set a project on the right path from the start. But it’s hard for more than one person to work on it until the foundation and structure has been set. Pairing allows more than one person to have input into the decisions that will affect the service for the rest of its life.
The Navigator (the person not actively using the keyboard) should have a roadmap of the key objectives to accomplish during the session. This would typically include decisions such as folder structure, naming conventions, project configuration, libraries to use, and testing strategies.
The Driver (the person doing the typing) should focus on understanding, analyzing and executing the task at hand to the best of their abilities. Don’t worry about the big picture and how it all fits together. That’s what the Navigator is there for.
Don’t forget to swap roles at least every hour.
2. Training a New Developer
It’s easy to feel overwhelmed when joining an existing team. The need to fit in and the desire to deliver value from the start can cause the new developer some anxiety. A great way for the new recruit to learn and produce in the first few days is to pair with an experienced team member. It’s also a great opportunity to start forming a bond with new colleagues.
The ideal task for pairing with a new recruit would give them an overview of most key components of the application they will be working on. With that task done, they should be able to take on a smaller task on their own.
It’s stressful to have someone you don’t know well watching you code. For that reason, it’s better for the new recruit to spend more time navigating. It gives them more time to absorb and ask questions, rather than try to write code for something they don’t yet understand.
3. Solving a Hard Problem
Every project has tasks that are hard to complete. Developers will tend to shy away from them and instead go for the quicker, easier wins. But those hard tasks won’t solve themselves. Pairing with a colleague on a tough task will increase the odds of it being done right from the start.
It’s good to swap the Driver and Navigator roles often when working on a tough problem. It’ll help find all the edge cases and ensure that both developers have the opportunity to think through the solution.