Why You Need Pair Programming For Your Next Agile Project
One person is hard at work while the other one’s constantly making coffee or checking their email. Does that sound like a familiar teamwork nightmare? Cause that’s what pair programming in Agile can look like if not done correctly.
In pair programming, two developers join forces to tackle difficult problems and share knowledge across the team. It’s a highly collaborative way of working that calls for a great deal of effective communication. Because of this, many development teams shy away from it.
However, pair programming can result in higher quality code, a more well-knit team, and faster product delivery rates.
In this article, you’ll read about the pros and cons of pair programming, best practices to make pair programming a success in your next Agile project, and a few examples of when NaNLABS implemented this practice to bring results to our clients.
Table of contents:
Ready to build your own custom software with a team that cares about you and your processes? We’re not code monkeys, we care about you.
What is pair programming?
Pair programming, sometimes called paired programming, is an Agile technical practice in which developers work together to produce higher quality code, develop new functions more easily, and tackle difficult problems.
The pair programming process involves two developers:
The driver shares the screen and writes the code
The navigator provides direction and double checks the work
The driver types while the navigator thinks through what is being done, and what needs to be done next. It’s important for pair programmers to switch roles to stay engaged and promote better skill sharing.
If the navigator only sticks to reviewing lines of code, they won’t fully understand the ins and outs of what’s being written. And if the driver is only focused on writing code, they’ll get less alert as time goes on and might lose sight of the overall direction.
Why use pair programming for Agile projects?
Pair programming, when done in moderation, can help ensure Agile continuous improvement and speed up the decision-making process.
Let’s take a look at some of the benefits and disadvantages of the practice to better understand why this technique might be right for your next Agile project.
Benefits of pair programming
Some of the advantages of pair programming include:
Improving code quality. Two engineers thinking about and working on the same problem means fewer errors and a more consistent codebase. With code checking, fast feedback, and iterative loops all happening in real-time, refactoring in Agile also becomes easier and more efficient.
Increasing knowledge sharing and skill transfer. Collaborating from a single workstation enables ongoing learning. Programmers can understand each other’s thought processes more easily and share knowledge and skills continuously. With pairs of varying skill levels, senior developers can use this as an opportunity to coach less experienced team members.
Creating a common practice across teams. Switching roles regularly helps establish a standard collection of practices across the team. This creates a more cohesive team and helps create more understandable and maintainable code.
Pair programming results in higher quality code and fewer mistakes, and encourages Agile continuous improvement.
Disadvantages of pair programming
While pair programming has many advantages and can help teams more easily adopt new Agile practices, like Test Driven Development (TDD), it also has some drawbacks. Pairing can get
Time-consuming. The constant discussions, brainstorming, and feedback can make coding take longer than if one developer were to do all the work. But if done correctly, pair programming helps teams write more maintainable code and spend less time fixing bugs. So in the long run, it’s totally worth it.
Exhausting. If developers aren’t used to this technique, working in pairs can get all-consuming and intense. But pair programming isn’t right for every project and doesn’t need to be a constant part of your workflow. Introverts rejoice.
Pair programming can be somewhat time-consuming at the beginning, and can get exhausting for developers who aren’t used to the practice.
How to get the most out of the pair programming process
Getting the most out of pair programming is like learning to channel the Force. Apply it incorrectly, and developers can easily turn to the Dark Side. (Or have an ineffective and unproductive experience that leaves the whole team frustrated.)
So how do you implement this practice correctly? Let’s dive in.
What do you do in pair programming?
Whether developers are sitting together behind a desk or practicing remote pair programming, some things about how the task is done remain the same:
First, plan for the session by setting an achievable goal and defining the tasks, the duration of the session, and how often you’ll switch roles.
Track the time and set an alarm to remind you of when you need to switch or stop the session.
Engage in active discussion with your pair partner during the work. The driver needs to talk their partner through each step and make sure the navigator is engaged. The navigator needs to actively participate in the session by making sure the plan is being followed and cross-referencing with the story ticket when necessary.
If applicable, write the code test-first to follow the Test-driven development framework.
Ask questions and be open to creative solutions to learn and facilitate continuous improvement.
Review the session and find out the successes and areas of improvement.
What are pair programming best practices?
Now let’s go over some best practices that will help you implement pair programming successfully, and create higher quality code more easily.
Here’s what Ulises Jeremías Cornejo Fandos, Software Developer at NaNLABS, has to say.
1. Use the appropriate tools.
2. Switch roles during work sessions.
3. Schedule regular short breaks to let your mind rest.
Taking regular short breaks during a pair programming session is essential since it allows programmers to reset and approach the problem with a fresh mind.
What are the best pair programming examples?
Some of the best examples of when to use pair programming are when development teams need to coach newer developers, or when they need to tackle complex problems.
To provide some context for what we mean, let’s take a look at when our Agile pods at NaNLABS used pair programming to achieve positive results more quickly for our clients.
Pair programming was used with WootCloud and Amalgam to increase the velocity of delivery and reduce architectural challenges and bugs.
While doing pair programming during these projects, NaNLABS used Discord to create a common space for the entire team. Discord has many functionalities, such as easy screen sharing with multiple developers at the same time, conversation history, and open voice channels based on teams or dedicated to pair programming.
Doing this meant increased velocity and improved delivery. Although there were more developers working on the same task, there were fewer blocks associated with technical definitions, architectural challenges, lack of knowledge of a particular technology or simply errors or bugs.
On top of that, it generated a transfer of knowledge and strengthened the team, making an impact that exceeded the initial challenge, and improving the efficiency of the team.
So, should you bother with pair programming?
Pair programming is a highly communicative and collaborative practice within the Agile framework where two developers come together to tackle complex problems and even provide training to the less experienced of the pair.
This practice can result in higher quality code, shared knowledge across teams and less siloed work, and faster product delivery. However if not implemented correctly, it can easily get exhausting and time-consuming, and leave your whole team questioning why they even considered pairing to begin with.
That’s why it’s crucial to work with a team with an established culture of collaboration and a constant line of communication. Without a strong Agile culture, pair programming is more trouble than it’s worth.
Here at NaNLABS, we live and breathe Agile and have the experience it takes to dodge pairing red flags.
Ready to build your own custom software with a team that cares about you and your processes? We’re not code monkeys, we care about you.
Frequently asked questions about pair programming
How is pair programming useful in Agile development?
Pair programming is useful in Agile development because it leads to higher quality code, faster development, lower risk of error, and spreading knowledge across teams.
Is pair programming used in Scrum?
Yes, pair programming is a development practice that can be used in Scrum, since the framework allows software developers to use various processes and techniques to implement it.
What is the difference between pair programming and code reviews?
Pair programming is a collaborative practice that happens in real-time. But code reviews happen asynchronously after tasks are executed independently, to make sure the code produced by developers looks good.
What is the main benefit of pair programming in Agile?
Pair programming is a beneficial Agile software development technique that helps
Increase code quality since another programmer is always looking over the driver’s code.
Share knowledge within Agile teams and provide mentoring opportunities for junior developers.
Create a common practice and approach to programming across teams.