Pair Programming
  You will never work alone again!

         Naresh Jain
    naresh@agilefaqs.com

     Licensed Under Creative Commons by Naresh Jain
                                                      1
What is Pair Programming ?




                             2
Video of a Sniper team working together




                                          3
What did we see ?

Two guys working on the same task
Both have the same target
Both have different expertise
One executes the task
The other watches for external factors, evaluates the situation,
corrects him and validates success after execution
Two guys working as a team


                 Licensed Under Creative Commons by Naresh Jain
                                                                   4
What is Pair Programming ?




                             5
src: ThoughtWorks India
                          6
src: ThoughtWorks India
                          6
Pairing	
  
                    Station

src: ThoughtWorks India
                                  6
Driver




                    Pairing	
  
                    Station

src: ThoughtWorks India
                                  6
Driver




                                  Navigator




                    Pairing	
  
                    Station

src: ThoughtWorks India
                                              6
Next	
  line	
  of	
  code,	
  
                                     syntax,	
  API,	
  
                                   class	
  under	
  dev	
  




              Driver




                                                                    Navigator




                    Pairing	
  
                    Station

src: ThoughtWorks India
                                                                                6
are	
  we	
  in	
  the	
  right	
  direction?,	
  
                                  Next	
  line	
  of	
  code,	
     requirements,	
  alternatives,	
  
                                     syntax,	
  API,	
                    next	
  test	
  case,
                                   class	
  under	
  dev	
                   impact	
  




              Driver




                                                                                              Navigator




                    Pairing	
  
                    Station

src: ThoughtWorks India
                                                                                                                          6
Isn't it a waste ?

Two developers will do the work of one
Junior guys will slow down seniors
Less work will get done
My cost will double
Why would I put two people on a job that just one can do?



                Licensed Under Creative Commons by Naresh Jain
                                                                 7
TICO TICO (Guitar Four-Hand Exchanging) Video
       http://www.youtube.com/watch?v=CcsSPzr7ays




                                                    8
9
10
11
12
How does it Help?


   Licensed Under Creative Commons by Naresh Jain
                                                    13
Continuous Review


                    14
Less Defects
Defects caught early

                       15
Improvement in the
Quality of the Design

                        16
Better Problem Solving


                         17
More Economical


                  18
“Pair-Pressure”
ensures timely delivery

                          19
Rapid Hands-on
Approach to Learning

                       20
Better Induction of
new Team Members

                      21
Better Induction of
new Team Members

                      22
Saved Effort on Intra-
Team Documentation

                         23
Less Distraction leading
 to Higher Productivity

                           24
Improved Satisfaction


                        25
Sustainable Pace:
Helps you slow down
      and think

                      26
Better Team Building
and Communication

                       27
Project Management:
Risk Mitigation Strategy

                           28
We are in the business of building software and this process
requires craft and skill, rather than a series of manual steps.

  Programming requires lot of thinking, creating abstractions,
         figuring out the logic and trying out things.

An evolutionary, iterative and collaborative process.

             Its a lot more than just typing code.
    (Using the keyboard or even worse, using the mouse)




                                                                  29
A Normal Pair Programming Video
http://www.youtube.com/watch?v=q-QWdFa4awI




                                             30
Consider the following...
    An experiment on Pair Programming
           at University of Utah




        Licensed Under Creative Commons by Naresh Jain
                                                         31
Cost and savings




Licensed Under Creative Commons by Naresh Jain
                                                 32
Cost and savings




Licensed Under Creative Commons by Naresh Jain
                                                 33
Cost of fixing defects

Cost	
  of	
  defect




                                          Time




                       Licensed Under Creative Commons by Naresh Jain
                                                                        34
Cost of fixing defects

             Cost	
  of	
  defect




                                                       Time



“IBM reported spending about $250 million repairing and reinstalling
           fixes to 30,000 customer-reported problems.
              That is over $8,000 for each defect!”

                     - “A Discipline for Software Engineering”, 1995, Humphrey, W.S.

                                    Licensed Under Creative Commons by Naresh Jain
                                                                                       34
Incorporating pair-programming into a
software development process will help
   yield software products of better
quality in less time with happier,
   more confident programmers!



                                         35
Points of resistance
    Things to watch out for...




    Licensed Under Creative Commons by Naresh Jain
                                                     36
Difficulty in convincing
 stakeholders to let two
people work on one task

                           37
Everyone settles down
into a “Comfort Zone”
Pairing would disrupt it

                           38
Strong Code Ownership


                        39
People Who Don’t Care


                        40
Developers not involved
in Estimation and Planning

                         41
Inconsistent
Workstation Setup


                    42
Small Work Area
  (Cubicles)


                  43
Techniques of Pairing


     Licensed Under Creative Commons by Naresh Jain
                                                      44
Ping-Pong Pairing


                    45
Keyboard n Mice Pairing


                          46
Selective Pairing


                    47
Cross functional Pairing


                           48
Distributed Pairing


                      49
Tips n Tricks


 Licensed Under Creative Commons by Naresh Jain
                                                  50
Pairing Stations


                   51
Pair Rotation with
   Pair Hinging

                     52
Promiscuous
Pair Programming

                   53
Pairing Round


                54
Pair Stairs


              55
Spikes


         56
Pairing Smells
 Things to Watch out for...




 Licensed Under Creative Commons by Naresh Jain
                                                  57
Pair Programming Anti Patterns Video
http://www.youtube.com/watch?v=ReuFZYtGeCc




                                         58
No Pair Rotation


                   59
Only one person driving
    Distracted Pair

                          60
Selective Pairing closer
     to a Release

                           61
Manager decides the Pairs


                        62
When its not necessary?


Tasks which involve Mundane Work (may be)
Trivial bug fixes like Typos
One person in the Pair is Sick




                 Licensed Under Creative Commons by Naresh Jain
                                                                  63
F.A.Q.s


How do you do estimation? Its 2 people working on one task now.
How do you do performance reviews for individuals?
Can we keep it optional for some people on a team?




                Licensed Under Creative Commons by Naresh Jain
                                                                  64
References

The Costs and Benefits of Pair Programming
   - Laurie Williams & Alistair Cockburn
Strengthening the Case for Pair-Programming
   - Laurie Williams, Robert R. Kessler, Ward Cunningham & Ron Jeffries
On the Economic Feasibility of Pair Programming
   - Hakan Erdogmus & Laurie Williams


                  Licensed Under Creative Commons by Naresh Jain
                                                                      65
Thank You!




Questions?
  Licensed Under Creative Commons by Naresh Jain
                                                   66

Pair Programming