Let's explore how we can use pair programming effectively.
23rd May 2019
Pair programming is an Agile software development technique in which two programmers work simultaneously on one task to achieve the best results. How does it work? What are its advantages? How can we use pair programming effectively? I’ll be answering all of those questions in this post so sit tight.
How do you use pair programming?
It’s simple, effective and achievable for most offices. Two programmers typically work (both literally and metaphorically) alongside one another on a task whilst both acting in two different capacities to ensure accuracy and efficiency.
The driver writes the code whilst the observer/navigator reviews each line.
Is it common practice?
Strictly speaking, no. Not everyone uses this technique. It’s a topic that often divides developers with some preferring to work autonomously on code and others viewing it as a waste of time.
It may look like an ineffective use of resources on paper. At We Are Mobile First, for example, we could have two programmers working on the same task for 1-2 weeks at a time. If we weren’t adopting the pair programming technique, they could’ve been working on separate tasks – presumably accomplishing more.
Is the last assumption entirely accurate? In my opinion, no.
So, why use pair programming?
There are many advantages of pair programming. Here’s a small selection of them:
It keeps things focused.
In delegating finite tasks to each pairing, it’s much easier to maintain focus as the work is fluid and keeps distractions to a minimum.
It increases code quality and prevents mistakes.
In maintaining a defined focus, pair programming encourages clearer articulation of the complexities of code. This leads to productive discussions that thus reduce the risk of error.
It produces ‘better’ solutions.
Two heads are better than one!
Each session comes with its own set of problems to solve. When developers pair up, the decision-making process benefits from two sets of experience and knowledge.
This makes for well-considered solutions that are evaluated there and then as opposed to once they’ve been implemented.
It doesn’t waste time.
Whilst effective communication takes time, it brings issues to the surface earlier on in the process thus preventing time-wasting when issues are left to linger.
It improves teamwork and promotes mutual learning.
Mutual learning, from developer to developer, is a great way to diffuse knowledge and skills across your team.
Pair programming provides the perfect environment for this diffusion, especially when you pair a developer who is less familiar with a component with a fellow developer who knows it inside out.
This is a great way of helping your junior developers broaden their skillset whilst also equipping your senior developers with the skills they need to support their fellow team members.
Harvesting these shared experiences is also a great way of encouraging bonding and understanding on a social level.
It aids company culture.
The communication that pair programming requires often seeks to boost company culture by manifesting a stronger sense of team identity and fostering better relationships between team members.
In creating an environment that thrives on mutual learning and improved social skills, you’re adding value to your team and creating a better workplace.
How to use pair programming effectively
I have been trialling pair programming since the start of the year and I’ve found it to be extremely insightful. Armed with newfound knowledge and experience, here are my top tips for using pair programming effectively.
You shouldn’t be working in silence. Communicate regularly and make sure you’re actively listening to one another to prevent mistakes or miscommunication.
Define how you’re going to solve the task at hand, discuss various approaches and decide on your roles. Ensure that you’re both consistently engaged in the task to avoid making mistakes.
Switch roles every so often.
Switching roles can be a great way to stay focused and maintain a clear understanding of what your role entails.
Synchronize what you’re doing with the rest of the team.
Don’t isolate yourself from the wider team. Take time to synchronize and inform everyone of what you’re doing.
This helps seamlessly integrate everyone’s work and is also a great way of workshopping progress. .
I have, personally, found pair programming to be an extremely useful technique. I’ve expanded my knowledge and improved my skills. I’ve also learned how to constructively communicate opposing approaches and built stronger relationships with my team members as a result.
Pair programming is a technique we often use here at We Are Mobile First. It has improved our performance, expanded our knowledge and skillset company-wide and provided us with a foolproof guide for onboarding new developers.
I’d highly recommend that you give it a go!
How do you feel about pair programming? Do you view it as a help or a hindrance? Tweet us and we’ll be sure to retweet the responses!
We Are Mobile First is a digital product agency based in Barcelona helping to transform businesses in a mobile-first world. Follow us on Twitter, LinkedIn and Medium to be notified of our future posts and stay up-to-date with our company news.