How to pair program effectively

Breaking Down Successful Pair Programming

Would have loved to read this article a few months ago. It describes really well, and goes beyond, what I learned about pair programming as a way of mentoring.

Summary

Pair efficiency is mostly determined by the effectiveness gap. This value describes the differences in domain knowledge, programming skill, prior experience etc. of the individuals. For example two juniors have a small effectiveness gap, a junior and a senior have a large one.

There are different kinds of pair setups:

  • junior + junior: should focus on learning
  • junior + senior: senior should focus on mentoring, junior on learning
  • senior + senior: should focus on producing business value

The most interesting pairing constellation is a junior plus a senior. In this case it’s most important to focus on mentoring and learning. It does not make sense to set the expectation for the senior to produce business value. Instead the focus should be on ramping up the junior really fast.

In this setting the junior should drive the pairing (especially keyboard and mouse), ask questions, design and implement the code.

The senior should provide constructive criticism and explain values behind her decisions. She must be very patient and emphatic. She must also let the junior make mistakes and not interrupt even when she sees the mistake a long way ahead.