One of the aspects of XP that also shows up in related styles of development, such as agile, is pair programming.

This is where you work as a team of two, at the same workstation. One of you is the pilot, operating the keyboard. The other is the co-pilot or navigator, and they sit off to the side, observing. Every so often, you switch roles.

Programmers working as a pair
Two programmers at work, pair programming. The pilot on the right, at the keyboard, with the navigator to the left. CC BY 2.0

This might sound wasteful- two people doing one job, and it is a matter of debate as to whether the gains are worth the losses. But the idea is, at the end of the day, you’re left with better quality code.

When programming, you have to do a lot of context switching- looking up other code and documentation, perhaps even editing your own documentation. Also, you have zooming in and out from big picture to details, from high-level architecture and API design, to inner loop optimisations. And whilst your IDE is doing its best, you’re also having to proofread your own work as you go.

Having a navigator helps with all of this. They can be keeping at eye on the specs, on the documentation, checking your work for conformity. They can see your mistakes, as they are a little bit removed from the immediate work, more of an observer. They provide an instant sounding board for decisions- I’m sure we’ve all suffered somewhat from option-paralysis, and a second can break that internal deadlock.

So that can make things quicker in terms of writing the draft code, but it also means the code is less likely to need bug fixing or revising. Less likely to be off-spec and be harder to debug or adjust later. Those savings can be massive, but it takes a bit of faith to see tomorrow’s results as being due to pair programming.

Pair configuring

So, quite a long preamble, to an essentially short question. What about pair configuring? Do any of you do it? I’m thinking for particularly mission-critical infrastructure work, such as core routers, mail servers, web servers, front-end proxies, databases- wouldn’t a second pair of eyes, a caution-urging collegial conscience be as useful, or more so? A single dot in the wrong place can be an unreachable IP, or a local directory path you want to delete, made absolute. A missing comma in a SQL query can mean aliasing a constant.

Given how many organisations seem to baulk at pair programming even when agile is gaining more and more traction, I doubt there’s much pair configuring going on. But I’d like to suggest we give it a go- even if informally, pulling in a co-worker to double-check our sums before hitting enter.

Oh, one more old-timer’s tip. When you’re logged in as root, sit on your hands a lot- and drop back down to a regular user as soon as possible. Better yet, keep to sudo’ing commands as and only when necessary.

Leave a Reply

Your email address will not be published. Required fields are marked *