Have you ever heard that idiom, “Two heads are better than one”? Well we totally agree with this and we get our devs to pair at every opportunity. It is important for our developers to grow their skill set and learn from one another, it improves our code quality and helps us complete tasks much more efficiently.
Pair programming is a method where two developers share a single desktop. One developer is the driver; operating the keyboard and mouse, the other is the navigator; reviewing, questioning and continually giving input. Both developers are fully engaged. Typically they will regularly swap seats during the day to give them both a chance to drive and navigate.
What are the benefits of pair programming?
Improves Code Quality
Two people working together can add the same amount of functionality as they would if working separately, but with much higher quality. Different ideas are tried and tested until only the best solution is written in code. While one dev is coding, the other is reviewing their work, eliminating mistakes. Two sets of eyes are better than one when code reviewing.
“Pair programming can be awkward at first and it can take some time to get right. But in my experience it has definitely proven itself to be a more efficient way of getting quality code out with less chance of comeback later.” – Candice Daniel, Senior Developer at Dev2
Drives Moral Support
Supporting one another makes it easier to keep going, and going well. Knowing you are not alone and constantly being pushed to give of your best can help a difficult piece move forward. Devs who share experiences are more likely to form strong work relationships and add to the culture of the company, which inevitably boosts morale.
Learning New Skills
Pairing developers on different levels and with different skills is an excellent way to learn and enhance the capabilities within the team. It is also a great way to on-board new employees and get them up to speed in a big code base.
You can learn things better from your partner, especially in areas that may be unfamiliar to you. Developers can also pick up best practices and better techniques from more advanced programmers. It can also facilitate mentoring relationships between two programmers.
Tasks are completed quicker
Over time, tasks are completed quicker when you take the net effect of improved quality and less comeback. Different levels of experience and knowledge help developers problem solve and complete tasks which they would have needed help with if done on their own. Overall we have found it to be much more efficient than the “divide and conquer” approach.
We choose when to pair program according to the task and its level of complexity. Sometimes pair programming is not suitable, but we use it where it fits. This allows our devs to get the most out of working together but also the space to do research, and work on bugs and features in their own capacity.
Following the Pomodoro Technique helps us divide up the work and ensure that we swap out the active coders. Managing time using this technique helps maintain the focus at a sustainable pace.
How has pair programming helped you? We'd love to hear your stories in the comments below.