Programming Methods

Pair Programming

Pair programming is a programming practice in which two programmers code together. There are a few styles that can be used when pair programming.

Template

  1. Define the duration and the poals for the session.
  2. Define the tasks you want to accomplish.
  3. Define how often you are going to switch roles.
  4. Track the time and put an alarm to when you need to switch or stop.
  5. Work together.
  6. Review the session and schedule the next session.

Driver and Navigator

One such style is Driver-Navigator; in which one programmer “drives” or writes the source at the keyboard and the other “observes/navigates”.

The observing programmer watches each line that the driver is writing, asks questions, or otherwise discusses with the driver the decisions being made so that they fully understand what the driver is doing. The navigator is meant to be a safety net for the driver in case they miss something, a guide if they are stuck and don’t know what to do, and a collaborator when discussing solutions to problems.

The driving programmer inputs source code text into files and discusses with the navigator what they are doing and why they are doing it. They should speak aloud what it is that they are doing as they solve the problems and express their reasoning to the observer. If the observer notices that the driver is stuck on an issue or isn’t explaining their reasoning well, then the observer should ask questions about what is being done.

After a period of time, the driver and observer will switch positions. This is done many times until the session is over.

Ping-pong

In this style of pair programming the two programmers will take terns writing failing tests and implementing functionality to make the tests pass.

Mob Programming

This type of programming extends the ideas of pair programming to as many programmers as would care to participate with the hopes that the entire team of programmers will participate. In this style one programmer drives or writes the source code at the keyboard while there are ’n’ navigators where ’n’ is an evolving number if not the whole team. Programmers using this style may even choose to only develop on a single computer that each programmer in the whole team (or those that choose to participate) will take terns writing source code on.