Monday, April 25th, 2016
Now that we know that Pair Programming is about Quality, it is time to explain how to perform this practice.
Pair Programming is a technique for writing programs line-by-line where two people sit down side-by-side at the same computer.
Pairings should swap pairs every 25 minutes and only last a few hours. Pairs must swap around frequently, not only to avoid pair fatigue, but so that the team can get the measure of each other and help each other to learn. They have to talk continually about their program, about the work in hand.
It is not a technique where one person programs and the other person watches.
It is a technique where one person assumes the role of “Driver”, while the other acts as “Navigator” or “Observer”.
- Controls the keyboard and has responsibility for the details of writing the code.
- Talks out loud about why they are entering any particular element of the code, to make the thought proces explicit so it can be discussed.
- Responds constructively to feedback given by the “Navigator”. Recognizes that comments from the “Observer” are part of the process, and doesn’t become annoyed, defensive or dismissive.
- Does not enter the code. Partners should talk through the ideas rather than simply “hand off” the keyboard to each other.
- Keeps a “big picture” view and thinks strategically about the direction in which the program is going, thinking of alternatives nd other ways of going about solving a problem.
- Watches, alerts, and asks questions, especially if the “Driver” is doing something that is unclear, cloudy, or unknown to the “Observer”, in constructive and supportive ways (Try this …, I notice that …, etc.)
Summing-up: Pair Programming aims to be truly collaborative and requires that partners communicate with each other openly and honestly. They must switch between the “Driver” and “Navigator” roles and should work to feel comfortable with both sets of practices, because the pair programming method depends on these set roles being carried out fully. Each programmer should take equal ownership for the generated code.