Top tips for getting pair programming right

As programmers race to develop new code and compete with the innovations to come out of Silicon Valley and Tech City in London, they’re constantly looking for ways to up their game, increase their work productivity and share knowledge across their teams.

One approach that’s starting to get more recognition is pair programming. While it’s been around for a long time, this technique is starting to take centre stage in the developer industry, as more and more companies come to realise its benefits.

After all, two heads are better than one and pair programming can help developers to write high quality code with fewer bugs, as well as increase team morale and enable better time management. Tech giants such as Facebook and Square have started to get in on the act, with the latter recently revealing that 15 per cent of its engineers pair full-time.

So how can any business looking to embrace pair programming ensure they’re getting the most out of their developers? Here are my dos and don’ts for getting it right.

Do:

  • Work simultaneously on developing the same code

Successful pair programmers are in constant communication and collaboration about code design and approaches. Our developers use two keyboards, two mice, one screen and a computer. While one programmer ‘drives’ and writes the code, the other navigates, driving discussions around the design of the application to ensure best practices are followed.

These roles should be switched at least every half an hour to keep both programmers fully engaged.

  • Have breakfast with co-workers and introduce ‘stand up’ meetings

A three to five minute meeting at the start of each day, where everyone physically stands up in a circle, enables collaboration and ideas to be shared more readily across the team of developers.

It’s something that we are committed to doing each morning at Pivotal. We begin every day by sharing breakfast and then stand up to share details of new projects the teams are working on, or even new lines of code they’ve developed.

Having breakfast together is important as it gets the whole office into a rhythm and gives everyone an opportunity to socialise.

  • Keep the product manager close when building applications

By bringing in the product manager at the earliest stage of software development, the programmer will be able to gain a better understanding of their requirements.

Say they are looking to design a data analytics application to drive insight into their customers’ behaviours.

They will create a more intelligent application that drives more meaningful insight into their customer data if they are able to physically work next to the developer, providing constant feedback and ideas of how they want the application to work.

  • Test, test and test again

Pair programming is not immune from error, and so developers embracing the technique are encouraged to use test-driven development (TDD) to ensure they’re developing software that’s fit for purpose.

This process relies on the repetition of a very short development cycle: the developers must first write a test that fails before they write just enough code to pass the test, and then finally refactor the new code to acceptable standards.

Don’t:

  • Be distracted when programming

Working in tandem with a programming partner requires each individual to be incredibly disciplined.

Getting distracted by email, social networking or shopping online will not only hamper the programmer’s own progress, but their partner’s too, and therefore breaks should only be taken at agreed times.

  • Worry about making mistakes

Pair programming brings the combined knowledge of two people to a problem. For example, it’s harder to go down rabbit holes when the developer has a partner at their side, as they tend to question their actions before they proceed.

It comes back to the point made above; continually testing software, developing new code and tweaking it until it’s right.

  • Forget to take regular breaks

Programming can be physically draining, particularly if the developers are staring at their screens for eight hours a day.

Developers should take regular breaks to give their eyes a rest and their brain time away from coding. Many programmers use their breaks to play games of ping pong, sticking to a fifteen minute time slot and using that period to run tests on their software in the background.

  • Work in silence

One of the key benefits of pair programming is increased knowledge sharing through teams, but this can only happen if the developers are in constant communication.

The best pair programmers adopt a highlight collaborative environment, talking back and forth almost non-stop. Learn off each other by asking for continuous feedback and suggest alternative ideas and solutions.

As more and more companies look to adopt agile software development, the practice of pair programming is spreading. By following these simple steps, companies looking to embrace the technique amongst their team of developers should be able to maximise their programmers’ time effectively.

JB Steadman is Director at Pivotal Labs.