Effective Pair Programming Techniques

“Two developers working on one computer” Is it so simple? Pair programming is a widely known style for practicing programming. Still, it has intermittent acceptance in the industry due to its varying results in short term. A lot of benefits of pair programming show up when practiced for long terms. Based on surveys many developers and organizations failed to understand the benefits of pair programming when exercised for a short duration(POC).

In this story, I am going to talk about what is pair programming, Styles of Pair programming, the benefits, and challenges of Pair programming.

What is Pair Programming?

Pair programming is collaborative efforts to produce high-quality software code. It's an effective coaching technique for novice developers while delivering commitments.

Styles of Pair programming

  • Driver and Navigator
  • Ping Pong
  • Strong-Style Pairing

The classic style of pair programming.

The driver is focused on completing the tiny goal at hand, ignoring larger issues for the moment. A driver should always talk through what she is doing while doing it.

The Navigator is in the observer position. He/She reviews the code, gives directions, and shares thoughts. The navigator also has an eye on the larger issues, bugs, and makes notes of potential next steps or obstacles.

Perfect for Test Driven Development (TDD).

  • Developer A writes a failing test
  • Developer B writes the implementation to make it pass.
  • Refactor code and test

Write a failing test (red), make it pass with the minimum necessary code (green), and then refactor.

TDD/Red-Green-Refactor

This style of pairing is good when you have novice engineers and experts engineer on the team. Very useful for knowledge transfer.

In this style, the navigator is usually the person much more experienced, while the driver is a novice with application, language, and syntax. The experienced person mostly stays in the navigator role and guides the novice.

Benefits of Pair Programming

  • Knowledge Sharing
  • Code review on Go
  • Collective code ownership
  • High-quality code

Challenges of Pair Programming

  • Pairing is exhaustive. Both programmers must be actively engaging with the task throughout a paired session, otherwise, no benefit can be expected.
  • Pair programming cannot be fruitfully forced upon people, especially if relationship issues.
  • Pair rotation makes handover difficult.
  • Intense collaboration can be hard. It needs strong empathy and interpersonal skills.
  • Pairing sessions are often interrupted by meetings.
  • Pairing Requires vulnerability

To pair requires vulnerability. It means sharing all that you know and all that you don’t know. This is hard for us. Programmers are supposed to be smart, really-crazy-smart. Most people look at what we do and say ‘I could never do that.’ It makes us feel a bit special, gives us a sense of pride and pride creates invulnerability.

Tom Howlett

References

Strategic Contributor and highly motivated leader with over 17+ years of experience strengthening Software delivery process to build high quality products.