A fair majority of the time I’ve spent coding in this past year at the BBC has been spent pair programming. It’s a bit weird to begin with – as a newbie (and one at a junior level), I thought that people would be criticising every line I wrote.
That highlights two of the misconceptions I first had about pairing. Firstly, it’s an exercise that is based around criticism: but it’s constructive criticism, and it’s by no means a negative thing. I think that was the first thing I learned about pairing. If you treat it as a learning exercise, and don’t take it personally, then you can learn a huge amount in a short time. But that’s something that both parties need to understand in order to get the most out of it.
This blog post is a write up of the things I’ve come to realise about pair programming, since I started using it on an almost daily basis.
It’s a skill
You might hear people say that pairing slows you down, and they’re right. But just like any other skill you learn, you speed up with time. The statement that pair programming with halve productivity also makes the massive assumption that 100% of the time developers spend working, is spent typing.
Sharing ideas and pushing back
I think this is where I’ve benefited most. For me, pairing is about the dialog - the conversation about what the best approach to the problem might be. It’s about sharing an idea, and listening to the feedback. You can learn a huge amount this way. Explain what you’re doing as you go along, if it’s not immediately obvious, and prepare to have your approach questioned.
When you don’t have control of the keyboard, don’t just sit back and relax. Try to understand what your pair is trying to achieve, and how. Would you have done it the same way? If not, say something!
I feel like mistakes is a bit of a harsh word here, but they happen. Things like spelling mistakes, missing semi-colons, closing one-too-many parentheses - the kind of mistakes I make all the time. Get a feel for how the person you’re pairing with likes to work, and how they correct their mistakes. Wait a bit before you dive in and pounce on something that they might have already seen.
Staying focussed, and on-track
Finally, remember to take breaks. Pairing can be intense at times, and it’s better to walk away and have a quick break than it is to keep pairing and lose concentration. That’s not productive, for either of you. Know when to walk away, but don’t go off on a tangent and forget to go back. A cup of tea usually does the trick.
And that’s about it, in my opinion.
If you’ve got any input, prod me on Twitter.