Pair Programming Explained

What is pair programming?

Pair Programming is an agile development method where two programmers work together on one computer system to complete a programming objective. They collaborate and verbalize their ideas by communicating with each other directly in real time. The programmer writing the code is called the Driver, and the programmer who reviews the written code is the Navigator. Driver and Navigator usually swap roles after agreed intervals, which is usually several times during the work day.

Why use pair programming?

How can two people get one task done faster? Many development teams think that pair programming will be expensive because the cost of development increases. The idea is to use pair programming to reduce the cost of the steps after the program is written. There is significant evidence that pair programming reduces the number of errors in the code, the written code is easier to understand, problems are solved faster because two minds can solve a problem faster than one mind, and the entire team has improved cross-function training.

There are a several benefits of pair programming:

  1. Better communication between developers.
  2. Source code will have fewer errors as bugs can be discovered earlier in the development process.
  3. Programming solutions are more elegant because two people agreed on the written solution.
  4. Improved source code readability because of varied experience of programming pairs.
  5. Less wasted time when resolving critical issues.
  6. The team is more cross-functional and more than one person was involved in the source code development.
  7. Teams will feel more empowered to make decisions as a team.
  8. More expertise as development ideas and techniques are shared within the team.
  9. Team members deliver better quality as they get to know each other through daily communication.
  10. Team members rely less on management to provide day-to-day programming direction.

There are a few issues with pair programming:

  1. Pairing a novice developer with another novice developer can nullify any potential positive effects.
  2. Two developers working on simple tasks are a much less effective use of programmer time, and is a potential waste of effort and money.
  3. The two programmers must get along with each other or the development team will suffer.
  4. It can be difficult to track errors to a specific programmer, which can make training difficult to manage.
  5. The cost of doubling the programming expense, hoping to save money on the debugging and testing phases, might be difficult for management to approve.

Pair Programming Tips

  1. Switch Roles Often – Programmers should switch roles every half hour. They should stay in the Driver or Navigator role for no more than one hour to prevent mental exhaustion from being the Driver too long or losing the required level of vigilance in the Navigator role.
  2. Be Courteous – When pointing out errors or better ways of writing the code, be polite to avoid offending your partners ego. Finding errors and suggesting corrections are a normal part of programming, and should not be used as an opportunity for ridicule or punishment.
  3. Don’t Argue About Formatting – Matters of formatting and approved code structures should be resolved before the pair programming begins. Don’t waste valuable time arguing over how to indent code or when comments should be added.
  4. Novice Drives – The person who knows the least about the language or systems used should spend most of the time as Driver. This will keep the novice programmer engaged with less risk of the expert making all the decisions.
  5. Communicate – Pair programming only works if both people are talking. The Driver must talk about what they are about to type, why they are writing the program code a specific way, and why they think it is the best way. The Navigator must ask questions about what is happening, why it is written is this specific way, and they must be prepared to call out questions, errors, and potential issues without being prompted by the Driver.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.