Pair programming is an agile software development technique in which two programmers work together at one workstation. One member, the driver, writes code while the other, the observer or navigator, reviews each line of code as it is typed in. The two people work together to design, code and test user stories.
- perhaps talk about what pair programming looks like at Artsy today (ad-hoc).
- Improve Quality - code review is done before or while the code is being written.
- Lower Development Costs
- Pair Learning (Knowledge Sharing)
- Team Building
The driver and navigator is the tradition style of pair progamming. In this style, one member, the Driver, has the keyboard and control of the input. Their job is to type and focus on the minute-to-minute coding. The other member is the Navigator and takes on the responsiblity of paying attention to the code being written as well as keeping in mind the bigger picture and guiding the driver in the right direction.
In the ping-pong style of pair programming, one member of the pair takes the role of writing the tests while the other pair is responsible for making the test pass. If both pairs are particularly familiar with test driven development this is can be a successful style of pairing. Ping pong pairing can also work where the pair responsible for writing code to make the first test pass then immediately writes a test that the first pair will be responsible for adding code that passes and so on.
- Discuss problem set and requirements up front to ensure they are well defined and both pairs have a clear understanding.
- Communicate what you are thinking both driver and navigator.
- Establish trust.
- Be Patient.
- Switch driver and navigator roles (every half hour).
- Take breaks:
- Take moments to celebrate as you complete tasks and overcome problems.
- When the pair is blocked.
- When an expert is paired with a novice, the expert should be prepared to play the role of mentor.
- The person who knows less about the system or language should do most of the driving.