Upload
steven-carter
View
216
Download
4
Tags:
Embed Size (px)
Citation preview
Pair Programming
Langr Software SolutionsOriginally presented to the Phoenix XP Users Group, October 2002
Last updated 2010
Copyright © 2010 by Langr Software Solutions. All Rights Reserved.
Pairing
Two programmersJointly developing production softwareNot “I watch over your shoulder”(That sounds like it would be waste of time!)
Copyright © 2010 by Langr Software Solutions. All Rights Reserved.
DynamicsMust pair if askedTwo roles in the pair: Strategic Tactical
Developers switch roles frequentlyRhythm
Copyright © 2010 by Langr Software Solutions. All Rights Reserved.
Mechanics
Comfortable workstations Accommodate two side by side Separate or shared input devices
Switch pairs at least once a day 3x / day?
Core pairing hoursTake breaks!
Copyright © 2010 by Langr Software Solutions. All Rights Reserved.
Technique Variants
Ping-pong pairing I code test, you code solution; we
switch
Promiscuous pairing Least-skilled remains on task
Promiscuous keyboarding Keyboarder switches every minute
Face-to-face
Copyright © 2010 by Langr Software Solutions. All Rights Reserved.
Additional Guidelines
5-minute argument rule5-second typo ruleBe attentive!
Copyright © 2010 by Langr Software Solutions. All Rights Reserved.
Review
Goals: Remove defects Prevent similar mistakes in future Generate useful dataPairing != formal review process Different costs, focus, outcomes
Copyright © 2010 by Langr Software Solutions. All Rights Reserved.
Formal Review Challenges
Disinterested parties That weren't involved in creating
solution View product of others as a distraction Find mostly low-hanging fruit
Anything occurring after the fact... Often doesn't get done or done well Often doesn't result in changes
Pairing invests the “reviewer”
Copyright © 2010 by Langr Software Solutions. All Rights Reserved.
Context Switching
Incurs overhead costShould drive toward cleaner solutionFocus on “unit test cases as doc”Task owner describes current test case New partner helps flesh out test Can quickly understand how to realize
shouldDoSomethingWhenThisCondition
Copyright © 2010 by Langr Software Solutions. All Rights Reserved.
General Benefits
Continual reviewCoverageMinimized personnel dependenciesImproved designMinimized defectsSustainableMore rapid solutions
Copyright © 2010 by Langr Software Solutions. All Rights Reserved.
Additional Benefits
Improved understandingMinimizes open workspace distractionsConsistent pacing Individuals less likely to bog down
Team members rise to common levelIncreased collaboration Helps build a true team
Copyright © 2010 by Langr Software Solutions. All Rights Reserved.
Management Benefits
Reduced risk (better truck number!)Rapid training for new hiresInterviewing criteriaProblems less hiddenPeer pressureResource fluidityCross-pollination
Copyright © 2010 by Langr Software Solutions. All Rights Reserved.
Developer Benefits
Awareness of other parts of systemResume buildingDecreased time in (review) meetingsContinuous educationAbility to move between teamsRapid learning as new hireThe little things
e.g. Eclipse shortcuts
Copyright © 2010 by Langr Software Solutions. All Rights Reserved.
“But it takes twice as long…”
Consider: Debugging sessions Increased cost of change due to poorer
design Mull time Inconsistent team abilities Learning time
Copyright © 2010 by Langr Software Solutions. All Rights Reserved.
Studies
“Costs and Benefits of Pair Programming” Laurie Williams, Alistair Cockburn Pair: 15% slower Error free code went from 70% to 85%
"The Effect of Pairs in Program Design Tasks" Lui, KM, et al, IEEE Transactions, 2008
"Evaluating Pair Programming with Respect to System Complexity and Programmer Expertise" Arisholm, E. +84% effort to perform tasks correctly More complex systems: +48% correct solutions
Copyright © 2010 by Langr Software Solutions. All Rights Reserved.
IssuesPair dynamics Extrovert and Introvert mixes Expert and Novice mixesNot everyone can work this way If done well, many like it Some dislike but appreciate its benefits A small percentage will refuseSocial preferences / cultureFearPersonal habits
Copyright © 2010 by Langr Software Solutions. All Rights Reserved.
“I Like My Space”
You can still have itBut... building software is a team activityFind a balance between pairing and not Never mandate all or nothing
Copyright © 2010 by Langr Software Solutions. All Rights Reserved.
Other Considerations
Odd # of team membersCore hoursTeam of 1 - 2Distributed developersContext switching overhead
Copyright © 2010 by Langr Software Solutions. All Rights Reserved.
When Not Pairing
Meetings, email, documents, etc.Review existing code Analyze to understand of design/defect Determine areas for potential
refactoring
Spike solutionsBuild tools or AT frameworkIf you must work on production code: Come up with ground rules Do post-development inspections
Copyright © 2010 by Langr Software Solutions. All Rights Reserved.
Where Do I Start?Discuss it with your teamAgree on the values you want to deriveCreate an initial simple set of rules Revisit regularly
Learn to pair first To learn when not to pair
Influence through metrics If necessary, track pairing vs. not
Re-assess value regularlyEnsure a coach monitors interaction issues
Copyright © 2010 by Langr Software Solutions. All Rights Reserved.
Further Reading
http://en.wikipedia.org/wiki/Pair_programming
Atwood, Jeff. http://www.codinghorror.com/blog/archives/
000999.html
Langr, Jeff. http://langrsoft.com/articles/pairing.shtml
Agile Alliance articles in category Pair Programming