Assigning two programmers to one coding job may seem counter-intuitive, but it can produce surprising results. Let’s find out more.
Pair programming is when two developers work on a coding project together, but using only one machine.
Here’s how it works – both programmers have a keyboard and mouse. One programmer (the driver) does the actual coding, while the other (the navigator) observes, checks the accuracy of the code, clearing up any mistakes as they go. The navigator will also set the direction for the coding. Often, the two developers will swap places to keep things fresh, or if they have different skills which are needed at specific times.
Pair programming shifts coding from an individual pursuit to a collaborative activity.
In this article, we’re going to look more deeply at pair programming, and discover how it can make your development projects run more smoothly.
Starting pair programming in your organisation
As we’ll see, pair programming can bring substantial benefits with very few drawbacks. One of the great things about it is that if you have two developers in your company, you can implement pair programming.
Pair programming began in the 1980s, but became popular in the 1990s as part of Agile development methodologies. Organisations of all sizes, from small startups to Silicon Valley giants, have found success using pair programming. Google has relied on pair programming partnerships since its early days – in recent years, it has even implemented remote pair programming.
The optimum time to implement pair programming is when the two programmers are at different levels of experience or possess different skills. When you do it this way, the novice developer can learn from their more experienced colleague – although, veterans often find they learn new techniques from their younger charges too.
Benefits of pair programming
The main benefit of pair programming is that most of the time, it results in better code. While pair programming cannot totally eliminate bugs in the code, studies show that you will get 15% fewer bugs compared to what you get with one programmer on their own. The navigator can catch errors as soon as the driver types them in; they may also offer ideas on how to make the code shorter. When the project is complicated and challenges arise, two developers are better than one when it comes to solving problems.
Pair programming is also more efficient than you may think. Although you are allocating two developers to a single project, it is only 15% slower than having two programmers working independently on different projects, rather than the 50% that you may imagine. Plus, because the code is of a higher quality, you can bank the time that you would typically spend debugging,
Pair programming is a great teaching tool. When you pair a less experienced developer with a seasoned expert, it acts like on-the-job training for the newer programmer. It is such an effective way to share knowledge, implement best practices and improve your skills. The two programmers are also likely to build a mentor/mentee relationship which enhances the culture of your company.
Finally, with two people working on a project instead of one, the project is less susceptible to distractions. If one part of the team starts to drift off, the other can get them back into the zone. It helps programmers, who previously may have worked on their own, discover the value of teamwork and collaboration.
Downsides to pair programming
Of course, nothing is perfect – there are some drawbacks to pair programming:
While pair programming is only 15% slower than two programmers coding independently, it is still slower. This means you use more of your development budget when you implement it.
For pair programming to work, both programmers have to buy into it. They have to understand the benefits of working together, even if on an individual level, they may always not get on.
Both programmers have to be totally engaged during the coding process. If either one gets distracted, the whole thing can fall apart.
You need to allocate a space for pair programming where the two developers can talk (maybe even shout) at each other. This may not be possible in all offices, where other people are working close by.
Let’s be honest; many programmers would rather pull on a pair of headphones, get in the zone and code the way they want to code. For pair programming to work, they need to shift this mindset and recognise the value of teamwork over individual brilliance. Once a programmer can make this change, they will see the quality of their work rising. They may even enjoy it.
Find out more
Companies large and small have taken advantage of the efficiency benefits that pair programming can bring. They have also used it as a way to upskill less experienced programmers and improve workplace relationships.
How about you? Are you ready to implement pair programming in your organisation?
Let your favourite employers apply to you – request early access and we’ll be with you shortly.