Pair Programming is a great way to build software systems. When Pair Programming works, it has significant benefits:
- better ideas – continuous brainstorming, larger knowledge pool, less gaps in understanding and more brain power to solve design problems;
- better quality – fewer bugs, instant validation of ideas, consistent approach and stricter adherence to team conventions;
- better knowledge – experience and knowledge sharing, deeper understanding of why, how and what was done;
- increased productivity – better focus and higher intensity, pushing each other and motivating to achieve best results, less procrastination and wasting of time;
- more enjoyment – most people like to work in groups and solve together interesting problems.
Extreme Programming leaders insist that all significant development should be done in pairs. But can we say that Pair Programming is the best method in all situations?
Programmers can find plausible alternatives to Pair Programming that don’t require two people sitting together all the time:
- ideas - frequent team brainstorming combined with short pair (or team) programming sessions for the most complex tasks;
- quality - dedicated tester closely works with developers, writing together automated tests;
- knowledge - frequent discussions, code reviews, training sessions;
- productivity - clear intent and pragmatic approach that bring focus, clarity and efficiency;
- enjoyment - close cooperation and mutual support
When Pair Programming is the most effective method?
The most important factor is match of skills and challenges. In Solo Programming the most productive mode is Flow when skills and challenges are matched. Pair Programming adds one more effective mode – Coaching that increases overall team productivity for the present and future tasks.
2. Coaching – expert programmer have experience and knowledge for solving the problem and shares it with other programmer, who cannot effectively solve problem alone. This more junior programmer has fundamentals to understand the solution and implementation. He learns and grows to become better programmer.
3. Wasting expert time – the problem is too simple that makes involvement of expert ineffective even for coaching
4. Overwhelmed novice – the problem is too complex or requires too much new knowledge that prevents the programmer from learning anything useful
5. Two experts for a manageable task – pair programming doesn’t have much benefits if both programmers know how to implement the task and successfully solved similar problems before.
6. One programmer is in Flow, other is Learning – it is difficult to stay in Flow if other programmer frequently interrupts and needs many explanation for basic things that are not directly related to challenging problem.
7. One programmer is in Flow, other is Coaching – to make this mode successful for the growth, the coach should be open minded, avoid directing too much and should give opportunity for another programmer to come up with own (maybe even better) solutions.
In addition, psychological problems could prevent successful pair programming:
- Intimidation by expert – one programmer is intimidated by superior skills of other programmer and afraid to be considered as incapable
- Need time to think – a programmer needs more time to think over before pair programming, but he is forced to start pair programming session before thinking over his ideas
- Prefer to work alone – an introvert programmer likes to work alone (loner).
- Personal antipathy – programmers don’t like each other
Can we make Pair Programming always effective?
Yes! Match tasks, skills and pairs. Try to find pairs for 2 productive modes – Flow and Coaching. A team will be most productive if the programmers pair solves together interesting problems matching their skills and learn from each other.
However, Pair Programming should be a free choice and preferred method, but it should not be a forced mandatory practice. As you can see from this post, there are some modes and psychological situations when Pair Programming is not working well.
In short, Pair Programming is one of the most useful tools in arsenal of the software team. Know when and how to use it.
Inspiring resource: Flow, Mihaly Csikszentmihal