RaccoonNotesGif

Pair Programming

For me, pairing is a key practice of Extreme Programming (XP). Pair Programming is a practice where two engineers work together to implement software. When pairing we take up the roles of Driver, the person typing, and Navigator, who is observing so they can focus on the higher-level concerns like the requirements, code design etc. The Driver and Navigator should swap roles regularly.

These are what I expect to be the benefits of pairing:

Pairing is my default technique on most programming tasks but that doesn’t mean I do it all the time. For example, when there are an odd number of people around, of course, there will be at least one person not pairing, and this is fine. Sometimes it’s good to get some time on your own to find out how much you have learnt from previous pairing sessions. Equally, in a workplace we don’t all start and finish work at the same time or go for lunch at the same time, this is all expected which means we have to have the flexibility and technique to facilitate pair rotation, swapping out one of your pair for a different team member, and for a single member of the pair to continue with the work without the other. Through good communication, driver swapping, TDD, and organisation techniques like making checklists for tasks within a story, we can make our pairs resilient to any one of the individuals leaving the pair.

I consider pairing to be a form of continuous code review and so don’t tend to enforce any further third-party code review, although depending on the risk of the change or focus on quality in a particular item of work I might seek might consider doing a code review in addition to pairing. I would recommend code reviews when programming work has not been paired on so that even when working alone you do get a feedback loop but given the feedback comes later than it would with pair programming, it often ends up resulting in rework or a feeling that going back and doing some of the recommended changes is somehow no longer worth the effort given the functional benefits of a given story might already have been met.

While I love pairing you do need to make sure you are getting the benefits and it takes practice.

Here are a few things to watch out for when pairing to keep it constructive:

If you are considering bring pair programming into your workplace, you might want to consider reading my reflection on change a workplace practice.