5 Tips for Better Pair Programming
Using good communication to have more production, open, and fun pair programming sessions
Pair programming is an essential skill for any developer who works on a team. It is a great way to improve your code quality, learn from each other, and get started in more complex projects and codebases. If you have never paired before, it usually consists of two developers working together on one task. Typically there are two roles, a driver and a navigator. The driver sits at the keyboard and physically types the code, while the navigator provides the instructions for what the driver should be doing. Each person takes turns fulfilling each role. In this post, i will walk you through some tips I have discovered that lead to more productive, happier pairing sessions. Lets dive in!
Table of Contents
- Table of Contents
- Tip #1: Set up the parameters of the session before beginning
- Tip #2: Set Goals
- Tip #3: Be an empathetic navigator, but don’t be an island
- Tip #4: Be a dutiful driver, but make sure you understand
- Tip #5: Ask for feedback
Tip #1: Set up the parameters of the session before beginning
In order to start off your pairing session on the right food, it is essential to first set some ground rules. Have a conversation with your partner about your previous pairing experience, and just get to know each other a little bit. Here are some great topics to go over:
- How long will the session be going for?
- How long of intervals do you want to work before swapping roles?
- Do you want to take breaks? How long? How often?
- Who will be the first driver?
- What is something that bothers you in a pairing session?
- What is something you really enjoy in a pairings session?
- How do you like to give and receive feedback?
Tip #2: Set Goals
It is helpful to set some concrete goals of what you want to accomplish during the session. Write down your goals somewhere you both can see them, and asses your progress each time you switch roles.
Tip #3: Be an empathetic navigator, but don’t be an island
As the navigator, it is your job to explicitly instruct the driver what to do. However, make sure your partner is following you! Check in with them every to often to make sure they understand the code that is being written. This is a great opportunity for growth, so if you are navigating and are more experienced, help the driver understand the decisions you are making. If you are the navigation but are less experienced than the driver, don’t be afraid to ask for help. Just because you are in control, doesn’t mean you can’t ask for suggestions. Ultimately, pair programming is meant to be collaborative, so keep an open mind and don’t be afraid to make mistakes.
Tip #4: Be a dutiful driver, but make sure you understand
As the driver, it is your job to follow the navigators instructions. If you are the more experienced programmer, make sure you give the driver space to work out their thoughts. If you think that they are making a mistake, or that you know a better way, perhaps wait a moment before immediately giving your thoughts. Let the driver make a mistake and correct it themselves! Or, perhaps wait until you reach a pause or an end of a block of code, and then offer your suggestion. There is a fine line to walk between being helpful and bulldozing over the navigator’s ideas. If you are the less experienced programmer, make sure you understand what you are typing! Don’t be afraid to speak up and ask questions. It is a good idea to check in at the end of each code block and go through each line together if needed. Driving for an experienced navigator is a great way to learn!
Tip #5: Ask for feedback
Once you have reached the end of your session, talk about how it went! What were the big wins, and what could have gone better? Ask your partner for feedback, and be open to hearing what they have to say. Ask them if they are open to receiving feedback, and if they are, go ahead! Always make sure to include positive feedback as well as any constructive feedback. If you discussed how you each prefer to give and receive feedback before the session, make sure you respect your partner’s wishes. Feedback can be hard to give and receive sometimes, but it is essential to becoming a better pair programmer. Finally, thank your partner! Gratitude will make the experience more positive, and help in building a healthy pairing relationship.
As you can see, communication is essential in all aspects of pair programming. Learning how to talk about both your code and your preferences will ultimately make you a better programmer. And of course, the best way to become a better pair programmer is to practice, practice, practice! If you don’t know anyone in person (or happen to be living in the time of a global pandemic), pair over the internet.Many open source communities have members who are more than happy to pair with a newer developer to help them get started in open source. This is a great way to build your network and learn how to contribute to open source projects, and is great experience for working on large codebases.
Thank you so much for reading, and best of luck with your pairing sessions!