Pair programming is a strong tool kit in extreme programming’s tool box. Two programmers works on same workstation one wearing a driver’s hat and the other one wearing an observer’s hat, exchange their roles at frequent intervals of time that they agree upon, steer the program to its conclusion. The dual perspective on same problem is at the core of this technique. Tough there are two brains working on same problem, they should have a conscientious to collaborate and not to compete. While the implementation is on its way, the same is being reviewed as its being written. So it saves a big time on future defects and code review requirements while engaging two people on same task.
It’s important to have some house rules for any such collaboration happening to achieve a task to its done state. Team work is as challenging as much its efficient. Still there’s no need of a handbook for these rules. It’s the best practices that learned during the journey. We inspect and adapt, we discard few rules as we feel them redundant or destructive for our goals and form new ones to make our pair programming more fruitful.
To list an example of such rule, we sometimes get carried away in the midst of the task that we start feeling possessive to hand over the precious piece of code that we are coding, to the pairing person. This slowly sweeps in the division of the module that we are coding. This obviously kills the very purpose of pair programming. We do have time bounding to make the perspective neutral. Switching may at first seem inefficient but would reaps on as it continues.
The quality of the code is high as the defects are identified during development. Pair programming demands readability implicitly to the process as the navigator needs to read the code when driver implements it. Readability is a pre-requisite for the newbie working on the code during maintenance. Firstly the maintenance cost of such code is very low above that if this requires extension by new hands handling this code, it would come out naturally without any pain to understand the code.