Strong-Style Pair Programming
When the driver and navigator ask questions of each other, they engage each other in meaningful conversation and they also can understand each other.
Join the DZone community and get the full member experience.Join For Free
Pair programming is not about taking turns using the computer or being someone else’s typist. It’s about engaging two minds on the same problem so that a solution can be developed more quickly and with higher quality than if one person was working on it alone.
The two roles in pair programming are referred to as driver and navigator. The driver is the one with hands on the keyboard. It’s the driver’s job to get ideas into the computer and deal with the minutiae of typing. However, the driver’s main goal is to trust and support the navigator. As the driver, I often think of myself as in service to the navigator. I still voice my opinion or challenge things if I have questions, but as the driver, my hands are full — both literally and figuratively — so it’s hard for me to think several steps ahead. This requires being comfortable working with an incomplete understanding of the task, but that’s often a more efficient way to work.
The navigator, on the other hand, is free from the minutiae of having to type in code, and so is able to see from a broader perspective. One of the main jobs of the navigator is to share information with the driver at the right level of abstraction. The overall goal is to present information so it’s easier for the driver to process. The navigator should give the driver the next instruction needed to implement just in time and at the correct level of abstraction so the driver can enter it most efficiently. The navigator is thinking about the problem at a higher level of abstraction so has a sense of the direction they want to go.
It’s the navigator that tells the driver what to do next, but what if the driver has an idea for what to do next? Simple, just pass the keyboard. This helps keep both pair partners in sync with each other.
There are several different kinds of configurations you can adopt when doing pair programming.
One of my favorite approaches to pair programming is what Llewellyn Falco calls “strong-style pair programming.” He defines strong style pair programming as follows “In order for an idea to go from your head into the computer, it must go through someone else’s hands.”
The best advice I can give both the driver and the navigator is to take a break and ask questions when you have them. When you ask questions of each other, you engage each other in meaningful conversation and you also help to understand each other.
These natural breaks are also ideal for passing the keyboard back and forth. We want to trade driver and navigator frequently throughout the day. Typically this is anywhere from just a few minutes to twenty or thirty minutes, though some purists would say that naturally trading the keyboard every two to six minutes is ideal.
When I see teams stuck in the roles of driver and navigator for more than an hour at a time I’ll sometimes introduce an external timer initially set for twenty-minute intervals so they have a reminder to trade off. Since timers can interrupt the workflow of a pair it isn’t ideal, but it helps form the habit of trading off frequently, which tends to boost overall productivity among the pair.
Published at DZone with permission of David Bernstein, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.