Testability starts with code
Lorraine Steyn
@lor_krs @KRSSoftware
www.krs.co.za
Statistics, Averages, Lies
Pairing in Context of Agile
Pair Programming Described
Working Space
Benefits
Arguments Against Pairing
Q&A
Agenda
70-100 defects per 1000 lines of code
70% removed during development
Quality Inspections find 1 (true) defect per man-hour
QA’s are 20 x more effective than manual testing
Manual testing takes between 4 and 16 hours per defect
Stats, Averages,Lies
References:
Experience with Inspection in Ultralarge-scale Development, IEEE, Russell 1991
An Experiment to Assess the Cost-Benefits of Code Inspections IEEE, Porter
The Costs and Benefits of Pair Programming, ACM, Cockburn and Williams
Promiscuous Pairing and Beginner’s Mind, ACM, Belshee 2005
Pair Programming and the Mysterious Role of the Navigator, ACM, Bryant 2008
Assume 1000 lines of code, 100 defects, developer finds 70%
Assume 50 lines of code per hour = 20 hours to develop the code
30 defects go to QA, rate of 1 defect identified per hour = 30 hours
30 defects go to Testing, assume 10 hours to find 1 defect = 300 hours?
If we could halve the defects:
QA hours would reduce to 15, Testers would reduce to 150 hours …
Maths: Time = money
Applied Software Measurement,
Casper Jones, 1996
X X
Costs
Opportunity cost
Cost of rework : time, more people, energy, trust …
Safety, life-and-death issues
Economic loss
How does Agile help us with
code?
Customer collaboration over contract
negotiation
Responding to change over following a
plan
Working software over comprehensive
documentation
Individuals and interactions over processes and
tools
The Agile Manifesto
Scrum
XP
Communication
Simplicity
Feedback
Courage
Respect
Sit Together
Whole Team
Informative Workspace
Energized Work
Stories
Weekly Cycle
Quarterly Cycle
Slack
Ten-Minute Build
Continuous Integration
Incremental Design
Pair Programming
Swap often
Swap mouse and keyboard every 10 minutes
Prevents “watch the master” dysfunction
Swap pairs every 90 minutes to 2
hours
Highest velocity, lowest exhaustion
Tag Teaming
Driver / Navigator
Syntax
PercentageofSyntaxrelatedcomments%
Levels Syntax Vars Methods Domain Phys Other
Flow – achieved together
Constant explaining – to self and partner
Constant adjusting of approach
Syntax corrections, but hold back
Both need time to think
Micro design, discussed as you go
Very tiring!
X
In Practice
But doesn’t it cost More?
TIME +15% QUALITY +20%
Lines of Code
LINES -10%
Working Space
X
Code Benefits
Quality of 70% bug free (solo) rises to 85% (paired) – gain 20%
Constant micro design results in cleaner solutions – less code
Less code is better – simplicity, easier to read and support
Avoids confirmation bias – more innovation
Developers consider more alternatives together – robust code
People Benefits
Share knowledge and skills – silo busting
Easier on-boarding of new team members – mentoring
Shared problems are easier to tackle – motivation
Harder to procrastinate – productivity
Heightened communication – collaboration
Issues, Concerns and Excuses
None.
Personalities who can really not work together
Forcing people causes resentment
But it costs double…
“I work faster alone”
Spending more time training than developing
Workspace is not comfortable
Personal hygiene
Handling concerns
Ego – Primadonnas are not good in a team, lack of care for
team members
Imposter syndrome – fear of failure
People as Resources attitude – “but it costs double”
Pair Strategies
Senior – Senior Highest skills, good value
Senior – Junior Great for mentoring, good to great value
Junior – Junior Better than working alone, poor value
Senior – Tester Collaborate on Test Cases (TDD), winning
XP – making the world safe for developers
and vice versa
Q+A
Lorraine Steyn
@lor_krs @KRSSoftware
Agile Software Development and Coaching
www.krs.co.za

Pair Programming

  • 1.
    Testability starts withcode Lorraine Steyn @lor_krs @KRSSoftware www.krs.co.za
  • 2.
    Statistics, Averages, Lies Pairingin Context of Agile Pair Programming Described Working Space Benefits Arguments Against Pairing Q&A Agenda
  • 3.
    70-100 defects per1000 lines of code 70% removed during development Quality Inspections find 1 (true) defect per man-hour QA’s are 20 x more effective than manual testing Manual testing takes between 4 and 16 hours per defect Stats, Averages,Lies
  • 4.
    References: Experience with Inspectionin Ultralarge-scale Development, IEEE, Russell 1991 An Experiment to Assess the Cost-Benefits of Code Inspections IEEE, Porter The Costs and Benefits of Pair Programming, ACM, Cockburn and Williams Promiscuous Pairing and Beginner’s Mind, ACM, Belshee 2005 Pair Programming and the Mysterious Role of the Navigator, ACM, Bryant 2008
  • 5.
    Assume 1000 linesof code, 100 defects, developer finds 70% Assume 50 lines of code per hour = 20 hours to develop the code 30 defects go to QA, rate of 1 defect identified per hour = 30 hours 30 defects go to Testing, assume 10 hours to find 1 defect = 300 hours? If we could halve the defects: QA hours would reduce to 15, Testers would reduce to 150 hours … Maths: Time = money
  • 6.
  • 7.
    Costs Opportunity cost Cost ofrework : time, more people, energy, trust … Safety, life-and-death issues Economic loss
  • 9.
    How does Agilehelp us with code?
  • 10.
    Customer collaboration overcontract negotiation Responding to change over following a plan Working software over comprehensive documentation Individuals and interactions over processes and tools The Agile Manifesto
  • 11.
  • 12.
    XP Communication Simplicity Feedback Courage Respect Sit Together Whole Team InformativeWorkspace Energized Work Stories Weekly Cycle Quarterly Cycle Slack Ten-Minute Build Continuous Integration Incremental Design
  • 13.
  • 14.
    Swap often Swap mouseand keyboard every 10 minutes Prevents “watch the master” dysfunction Swap pairs every 90 minutes to 2 hours Highest velocity, lowest exhaustion
  • 15.
  • 16.
  • 17.
    Levels Syntax VarsMethods Domain Phys Other
  • 18.
    Flow – achievedtogether Constant explaining – to self and partner Constant adjusting of approach Syntax corrections, but hold back Both need time to think Micro design, discussed as you go Very tiring! X In Practice
  • 19.
    But doesn’t itcost More? TIME +15% QUALITY +20%
  • 20.
  • 21.
  • 22.
  • 24.
    Code Benefits Quality of70% bug free (solo) rises to 85% (paired) – gain 20% Constant micro design results in cleaner solutions – less code Less code is better – simplicity, easier to read and support Avoids confirmation bias – more innovation Developers consider more alternatives together – robust code
  • 25.
    People Benefits Share knowledgeand skills – silo busting Easier on-boarding of new team members – mentoring Shared problems are easier to tackle – motivation Harder to procrastinate – productivity Heightened communication – collaboration
  • 26.
    Issues, Concerns andExcuses None. Personalities who can really not work together Forcing people causes resentment But it costs double… “I work faster alone” Spending more time training than developing Workspace is not comfortable Personal hygiene
  • 27.
    Handling concerns Ego –Primadonnas are not good in a team, lack of care for team members Imposter syndrome – fear of failure People as Resources attitude – “but it costs double”
  • 28.
    Pair Strategies Senior –Senior Highest skills, good value Senior – Junior Great for mentoring, good to great value Junior – Junior Better than working alone, poor value Senior – Tester Collaborate on Test Cases (TDD), winning
  • 29.
    XP – makingthe world safe for developers and vice versa
  • 30.
    Q+A Lorraine Steyn @lor_krs @KRSSoftware AgileSoftware Development and Coaching www.krs.co.za

Editor's Notes

  • #3 Ask questions at end
  • #4 Other defects from QA’s are style preferences, misunderstanding of code, readability suggestions Only 15-35% of QA feedback must be fixed 2 reviewers were slightly more efficient than 1, no gains after 2
  • #5 Association for Computing Machinery
  • #6 50 lines of code per hour – so 20 hours to develop the code. 50% longer to inspect bugs out of it
  • #7 1956
  • #8 Satisfaction drops, morale, trust in team members, lowers collaboration
  • #13 Energized work – not removing value from the code Dial up sitting together if you have a problem
  • #14 2nd screen, only one laptop/pc
  • #15 Swap pairs per sprint, or per week, or daily. No wrong way. Small team, and the frequent swaps kept them all involved in all aspects. Mobbing in pairs
  • #16 Driver types, navigator directs the design and helps spot coding errors Stats showing this is not exactly what happens, call it tag team rather. Your turn, my turn, etc. The notepad is a big help – write goals and approach
  • #17 17 missing, 3 the navigator fell asleep, 2 driver just obeyed. Overall it’s balanced.
  • #19 Hour bursts, use paper, keep on track. Share the load – getting difficult, hand over to partner.
  • #21 Less is very good. Most time spent in support, and more reading takes longer.
  • #23 Personal space!
  • #24 Mob, relaxed, have space to withdraw and come together. Keyboard and mouse accessible by both.
  • #26 Not just new members, mentoring good for all We normally work like toddlers, along-side. Pairing is first real collaboration.
  • #27 Not judgemental – personal space, religious or cultural issues male/female, autistic people If a team is not convinced, they’ll find ways to avoid pairing