Government Digital Service (GDS)
Printable version

How to pair program effectively in 6 steps

Blog posted by: , 6 February 2018 – Categories:People and skillsTechnology.

GDS staff pair programming, looking at a screen together

GDS has used pair programming since its inception. It plays an important role in building our services. I recently gave a talk titled ‘How to be a good pair’ and the warm reception of the talk inspired me to share my observations in a blog post. This guide will be useful to people who have experience with pair programming or mob programming and to people totally new to it.

The benefits of pair programming

Before I go through my tips for successful pair programming, it’s useful to understand why this way of working is important. In the Digital Marketplace team, we use pair programming to write higher-quality code, but also to share knowledge and help with team building.

Communicating with and understanding the needs of your pair partner is just as important as the code you work on. These sentiments are echoed in a blog post by Taros Aires, a senior consultant developer at ThoughtWorks.

Below I take a look at 6 steps to keep in mind for more pleasant and effective pair programming sessions.

1. Prepare

To prepare for the session, take the following steps:

  • set aside time to do it – the amount of time you set aside will vary depending on your schedules (for example, the number of meetings you both attend), but I find that anything shorter than 2 hours feels constricted. Some of my favourite sessions have taken half a day, or even a (nearly) whole day (but please remember to take breaks!)
  • check in with your partner – ask them how they feel; are they still in the headspace to go ahead with the session? Maybe they need to go slower today or could use some emotional support? It is very helpful to know these things before you start
  • make a plan – before you start coding, talk about what you want to achieve during the session. Writing down objectives on post-it notes is a good way to plan your session
  • get comfortable – choose a space comfortable for both of you, preferably not too loud. Check if both of you can comfortably read the screen contents and that the code is up to date and working on both machines (if you use two computers)

2. Work closely together

When you’re pair programming, the usual set-up is for one of you to be the driver and the other to be the navigator.

The driver writes code, the navigator looks out for mistakes, ensures you’re both on track and calls a halt if necessary to rethink where you are, where you want to get to and how to get there.

It’s important to work together as a unit to make sure you get the best out of the session.

As the driver, it’s your job to talk your partner through each step when you code and make sure that your partner remains engaged. If you’re unsure, ask them to paraphrase what is happening to ensure they do understand.

As a navigator, make sure you stay engaged and actively participate in the session. Keep up the discussion with your pair partner and make sure that you are both:

  • following the plan
  • writing the code test-first as per Test Driven Development (TDD) principles, if relevant
  • cross-referencing with the story ticket when necessary

Your ways of working may change depending on who your partner is and that's ok.

3. Learn and facilitate learning

Things to pay attention to if you’re more experienced than your pair

If you’re pairing with a programmer who is junior to you or knows less about the particular problem you're working on, be mindful that this is an opportunity for you to help them develop their skills.

Let your pair navigate you towards the solution and encourage them to ask questions. Be patient. If you work too quickly, your junior partner may miss out on learning opportunities. If you feel that your pair partner needs some encouragement, you can provide it by asking open questions like: ‘What shall we do next?’ or ‘How would you solve this?’

Remember that you can also learn something. Junior programmers often come with fresh ideas as they are not set in specific ways of thinking.

Things to pay attention to if you’re less experienced than your pair

If you are pairing with a more experienced programmer, ask questions whenever you don’t understand something. Pair programming is a great way to learn on the job and get to grips with concepts that are new or difficult.

Be patient with yourself. You are here to work, but you’re also here to learn. Pay attention to how your pair partner approaches the problem, note the new tricks and elegant patterns/solutions to problems to remember them better.

Whatever your seniority is, remember that some of our needs remain the same regardless of our relative experience, as per the slide below, taken from a presentation by a software developer, Irina Tsyganok:

a slide showing that our needs remain the same regardless of your relative experience

Click here for the full blog post


Channel website:

Original article link:

Share this article

Latest News from
Government Digital Service (GDS)