Pair Programming

Pair Programming

Pair programming is a technique in which two programmers work in collaboration on the same workstation. The use of this technique is a trait of agile development methodology.

Since workstations have a single keyboard and mouse, the programmers adopt the role of driver and observer. The driver writes the code and the reviewer continuously reviews it. The two programmers must switch roles at pre-agreed intervals or the behest of either in the pair.

What are the pros and cons of pair programming?

Pair programming has but one major con. Pair programming approximately doubles the person-hours required to deliver any feature. Two programmers who would be working independently on two tasks are now working on a single task.

The benefits of pair programming are numerous:

  • The observer continuously reviews the code written by the driver, which will drastically reduce the post-development code review cycle.
  • The driver has the observer as a safety net, trusted to see that the code is clean and bug-free. The observer also keeps an eye on the big picture and general strategy.
  • In pair programming, both developers can have different areas of expertise. They both bring their unique strengths to the task at hand.
  • Even in differences, both developers generally learn something new from the other developers. They might even find better, more robust hybrid solutions.
  • Pair programming also prevents poor design decisions from being taken early on, thus reducing technical debt and future refactoring efforts.

Write clean and secure code with DeepSource

Powerful static analysis that takes 5 minutes to set up and helps you fix code health and security problems on every pull request.