Jump to content

Pair programming

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by 173.76.4.194 (talk) at 21:10, 11 October 2012 (Undid revision 516990341 by MrOllie (talk)). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Pair Programming at Chitika

Pair programming is an agile software development technique in which two programmers work together at one workstation. One, the driver, writes code while the other, the observer (or navigator[1]), reviews each line of code as it is typed in. The two programmers switch roles frequently.

While reviewing, the observer also considers the strategic direction of the work, coming up with ideas for improvements and likely future problems to address. This frees the driver to focus all of his/her attention on the "tactical" aspects of completing the current task, using the observer as a safety net and guide.

Costs and benefits

Some studies have found that programmers working in pairs produce shorter programs, with better designs and fewer bugs, than programmers working alone.[2] Studies have found reduction in defect rates of 15% to 50%, varying depending on programmer experience and task complexity.[3][4] Pairs typically consider more design alternatives than programmers working solo, and arrive at simpler, more-maintainable designs; they also catch design defects early.[5] Pairs usually complete work faster than one programmer assigned to the same task. Pairs often find that seemingly "impossible" problems become easy or even quick, or at least possible to solve when they work together.[2][6]

Knowledge passes between pair programmers as they work. They share knowledge of the specifics of the system, and they pick up programming techniques from each other.[2][7] New hires quickly pick up the practices of the team and learn the specifics of the system.[8] With "promiscuous pairing" – each programmer cycling through all the other programmers on the team rather than pairing only with one partner – knowledge of the system spreads throughout the whole team, reducing risk to management if one programmer leaves the team.[2]

Pairing usually brings improved discipline and time management. Programmers are less likely to skip writing unit tests, spend time web-surfing or on personal email,[9] or cut corners when they are working with a pair partner. The pair partner "keeps them honest".[10][11] People are more reluctant to interrupt a pair than they are to interrupt someone working alone.[12]

Additional benefits reported include increased morale[13] and greater confidence in the correctness of the code.[2]

Scientific studies

The Economist noted, "Laurie Williams of the University of Utah in Salt Lake City has shown that paired programmers are only 15% slower than two independent individual programmers, but produce 15% fewer bugs. Since testing and debugging are often many times more costly than initial programming, this is an impressive result."[4] (Note: The original study showed that "error-free" code went from 70% to 85%; it may be more intuitive to call this a 50% (rather than 15%) decrease of errors, from 30% to 15%.)

The Williams et al. 2000 study showed an improvement in correctness of around 15% and a 20%–40% decrease in time, but between a 15% and 60% increase in effort—that is, total programmer-hours. Williams et al. 2000 also cites an earlier study (Nosek 1998) which also had a 40% decrease in time for a 60% increase in effort.

A study (Lui 2006) presents a rigorous scientific experiment in which novice–novice pairs against novice solos experience significantly greater productivity gains than expert–expert pairs against expert solos.[14]

A larger recent study (Arisholm et al. 2007) had 48% increase in correctness for complex systems, but no significant difference in time, whilst simple systems had 20% decrease in time, but no significant difference in correctness. Overall there was no general reduction in time or increase in correctness, but an overall 84% increase in effort.[15][16]

Lui, Chan, and Nosek (2008) shows that pair programming outperforms for design tasks.[17]

A full-scale meta-analysis of pair programming experimental studies, from before or during 2007, (Hannay et al. 2009) confirms "that you cannot expect faster and better and cheaper". Higher quality for complex tasks costs higher effort, reduced duration for simpler tasks comes with noticeably lower quality – the meta-analysis "suggests that pair programming is not uniformly beneficial or effective".[18]

However, a 2007 meta-analysis concluded that "pair programming is not uniformly beneficial or effective" because many other factors besides the choice of whether to use pair programming have large effects on the outcome of a programming task.[18] The meta-study found that pair programming tends to reduce development time somewhat and produces marginal positive effects on code quality, but that pair programming requires significantly more developer effort; that is, it is significantly more expensive than solo programming. The authors suggest that studies of pair programming suffer from publication bias whereby studies that would not show that pair programming is beneficial were either not undertaken, not submitted for publication, or not accepted for publication. They conclude that "you cannot expect faster and better and cheaper."

This study suggests that even though coding is often completed faster than when one programmer works alone, the total amount of man-hours (number of programmers × time spent) increases. A manager needs to balance faster completion of the work and reduced testing and debugging time against the higher cost of coding. The relative weight of these factors can vary from project to project and task to task. The benefit of pairing is greatest on tasks that the programmers do not fully understand before they begin: that is, challenging tasks that call for creativity and sophistication.[14] On simple tasks, which the pair already fully understands, pairing results in a net drop in productivity.[14][15] Productivity can also drop when novice-novice pairing is used without sufficient availability of a mentor to coach them.[19]

Non-Performing Indications

There are a few indicators that a pair is not performing well:

  • Disengagement – One of the members physically moves their chair away from the keyboard, or starts working on their email, etc. Sometimes this can be as extreme as one member falling asleep.
  • Watch the Master – Sometimes one member will be more experienced than the other. There is a temptation to defer to the more senior member, and the less senior will be relegated to observer status. This will often lead to disengagement.
  • Silence – Pairs cannot work together if they are not talking to each other.[20]
  • Thought Variance - Even if we consider the Watch the Master, a particular program written has different ways to implement by each developer depending on the framework (s)he experienced. This will often lead to confusions and a third person has to decide (Search in Google or Opinion from Team Lead) on which approach to take.
  • Effort Variance - Since both concentrate on one particular program, effort in terms of man hours will be divided equally. The chances of parallel work done for a release will be ruled out and two person working on the same computer equally means spending 16 hours as 8 hours.[citation needed]

Variants

Remote pair programming

Remote pair programming, also known as virtual pair programming or distributed pair programming, is pair programming where the two programmers are in different locations,[21] working via a collaborative real-time editor, shared desktop, or a remote pair programming IDE plugin. Remote pairing introduces difficulties not present in face-to-face pairing, such as extra delays for coordination, depending more on "heavyweight" task-tracking tools instead of "lightweight" ones like index cards, and loss of non-verbal communication resulting in confusion and conflicts over such things as who "has the keyboard".[22]

Tool support is provided either by a screen sharing software (such as VNC or RealVNC[23] [24] [25] or the multi-display mode (-x) of the text-based GNU screen) or by specialized distributed editor tools (such as Gobby, Saros or XPairtise).

See also

Programs and plug-ins to support remote pair programming

References

  1. ^ Williams, Laurie (2001). "Integrating Pair Programming into a Software Development Process" (PDF). 14th Conference on Software Engineering Education and Training: abstract. {{cite journal}}: Unknown parameter |nopp= ignored (|no-pp= suggested) (help)"One of the programmers, the driver, has control of the keyboard/mouse and actively implements the program. The other programmer, the observer, continuously observes the work of the driver to identify tactical (syntactic, spelling, etc.) defects, and also thinks strategically about the direction of the work."
  2. ^ a b c d e Cockburn, Alistair; Williams, Laurie (2000). "The Costs and Benefits of Pair Programming" (PDF). Proceedings of the First International Conference on Extreme Programming and Flexible Processes in Software Engineering (XP2000).
  3. ^ Canfora, Gerardo (2007). "Evaluating performances of pair designing in industry". The Journal of Systems and Software. 80 (80): 1317–1327. doi:10.1016/j.jss.2006.11.004. CiteSeerx10.1.1.101.9212. {{cite journal}}: |access-date= requires |url= (help); Unknown parameter |coauthors= ignored (|author= suggested) (help)
  4. ^ a b "Agility counts". The Economist. September 20, 2001..
  5. ^ Williams, Laurie; Kessler, Robert (2003). Pair Programming Illuminated. Addison-Wesley. pp. 27–28. ISBN 0-201-74576-3. With pair programming, 'four eyeballs are better than two,' and a momentous number of defects are prevented, removed right from the start. These continual reviews outperform traditional, formal reviews in their defect-removal speed.
  6. ^ Williams, Laurie; Kessler, Robert (2003). Pair Programming Illuminated. Addison-Wesley. p. 26. ISBN 0-201-74576-3. "Collaborative teams consistently report that together they can evolve solutions to unruly or seemingly impossible problems. … The driver might actually be working out a design or implementing a part of the problem, realizing that he or she may ultimately come to a dead end in the problem resolution. The navigator, while watching the driver's partial design or implementation, begins thinking about the next step. When the driver hits the dead end, the navigator is often prepared to take over and lead the way. Often, the cycle continues until the problem is solved."
  7. ^ Williams, Laurie; Kessler, Robert (2003). Pair Programming Illuminated. Addison-Wesley. p. 29. ISBN 0-201-74576-3. "Knowledge is constantly being passed between partners, from tool usage tips to design and programming idioms. The partners take turns being the teacher and the student. Even unspoken skills and habits cross partners."
  8. ^ Williams, Laurie; Kessler, Robert (2003). Pair Programming Illuminated. Addison-Wesley. p. 112. ISBN 0-201-74576-3. "[Expert-novice pairing] can even be valuable for novices who are novices only in the sense that they haven't been with their team for very long. … Watching and then doing with an expert by your side can greatly reduce the time it would require to learn 'the right way' of working with the team. It really helps when the newbie works with many of the experts (or with any team member) so he or she can learn about many different aspects of the system."
  9. ^ Williams, Laurie; Kessler, Robert (2003). Pair Programming Illuminated. Addison-Wesley. p. 23. ISBN 0-201-74576-3. "Two people working in a pair treat their shared time as more valuable. They tend to cut phone calls short; they don't check e-mail messages or favorite Web pages; they don't waste each other's time." (Ward's Wiki 1999, contributed by Paul Chisholm).
  10. ^ Beck, Kent (2000). Extreme Programming Explained. Addison-Wesley. p. 102. ISBN 201-61641-6. {{cite book}}: Check |isbn= value: length (help)"Under stress, people revert. They will skip writing tests. They will put off refactoring. They will avoid integrating. With your partner watching, though, chances are that even if you feel like blowing off one of these practices, your partner won't."
  11. ^ Williams, Laurie; Kessler, Robert (2003). Pair Programming Illuminated. Addison-Wesley. p. 24. ISBN 0-201-74576-3."With any software development process there is a constant struggle to get the software engineers to follow the prescribed process. A benefit of pair programming is improved adherence to procedures and standards."
  12. ^ Williams, Laurie; Kessler, Robert (2003). Pair Programming Illuminated. Addison-Wesley. p. 24. ISBN 0-201-74576-3."Others see us already working with someone else, and they leave us alone. The net effect is that we have bigger blocks of uninterrupted time, which is good for our mental state and our progress. It also reduces task-switching, which for some people generates a huge overhead."
  13. ^ Williams, Laurie; Kessler, Robert (2003). Pair Programming Illuminated. Addison-Wesley. p. 21. ISBN 0-201-74576-3. "In our recent Web survey, we asked, 'What have you found beneficial about pair programming?' The single most common response was, 'It's a lot more fun!'"
  14. ^ a b c Lui, Kim Man (2006). "Pair programming productivity: Novice-novice vs. expert-expert" (PDF). International Journal of Human-Computer Studies. 64 (9): 915–925. doi:10.1016/j.ijhcs.2006.04.010. Retrieved 2008-07-21. {{cite journal}}: Unknown parameter |month= ignored (help) [dead link]
  15. ^ a b Arisholm, Erik (2007). "Evaluating Pair Programming with Respect to System Complexity and Programmer Expertise". IEEE Transactions on Software Engineering. 33 (2): 65–86. doi:10.1109/TSE.2007.17. Retrieved 2008-07-21. {{cite journal}}: Unknown parameter |coauthors= ignored (|author= suggested) (help); Unknown parameter |month= ignored (help)
  16. ^ Aranda, Jorge (2007-03-12). "Pair programming evaluated". Retrieved February 7, 2008.
  17. ^ Lui, Kim Man (2008). "The Effect of Pairs in Program Design Tasks" (PDF). IEEE Transactions on Software Engineering. 32 (2): 197–211. doi:10.1109/TSE.2007.70755. Retrieved 2008-07-21. {{cite journal}}: Unknown parameter |coauthors= ignored (|author= suggested) (help); Unknown parameter |month= ignored (help) [dead link]
  18. ^ a b Hannay, Jo E. (2009). "The Effectiveness of Pair Programming: A Meta-Analysis". Information and Software Technology. 51 (7): 1110–1122. doi:10.1016/j.infsof.2009.02.001. {{cite journal}}: Unknown parameter |coauthors= ignored (|author= suggested) (help); Unknown parameter |month= ignored (help)
  19. ^ Stephens, Matt. "Will Pair Programming Really Improve Your Project?". Retrieved 28 May 2011. {{cite web}}: Unknown parameter |coauthors= ignored (|author= suggested) (help)
  20. ^ http://www.agilesherpa.org/agile_coach/engineering_practices/pair_programming/
  21. ^ Flor, Nick (2006). Globally distributed software development and pair programming. Communication of the ACM, 49, 57-58.
  22. ^ Schümmer, Till (2009). "Understanding Tools and Practices for Distributed Pair Programming" (PDF). Journal of Universal Computer Science. 15 (16): 3101–3125. Retrieved 2010-04-30. {{cite journal}}: Unknown parameter |coauthors= ignored (|author= suggested) (help); Unknown parameter |month= ignored (help)
  23. ^ Agile Ajax: Pair Programming with VNC
  24. ^ Pair Programming - The Ultimate Setup and the other options we tried. - Jonathan Cogley's Blog
  25. ^ Ola Lindberg › Computer ergonomics and pair programming