Pair Programming
Preview to Pair Programming
 Asyraf
 rubynerds.blogspot.com
Why Pair?
 Increase your brainpower
 Concentrate one aspect of programming
 (coding) while your partner concentrates
 on another (design, todos etc)
 Reinforce good programming habits
 Many programmers find better code
 produced when pairing
 More focused – less interruption from
 azzart
Driver and Navigator
 Driver
 Person writing code – write, test, etc.
 Navigator
 Person doing the thinking – design, algorithm,
 what next etc.
Pairing Rules
 Switch roles between the two of you
 frequently – at least every half and hour
 Agree on standard tools to use (e.g.
 netbeans)
 Agree on a way to signal to people
 regarding their personal habits/hygiene
 (e.g. stink-breath)
Driver
 Think out loud
 say what your plans are when doing anything
 (e.g. 'I plan to do a for loop for this...')
 You may feel your navigator sees ideas and
 problems more quickly than you. This is right
 and should be how it works.
 Concentrate on writing good code and let the
 navigator think about design issues
How-to: Navigator
 Ignore Driver's little mistakes like missing
 a semi-colon
 Think about:
 What tests do you need to write?
 How does the code integrate with the rest of
 the system?
 Can the code be better? Use other methods?
 Can the design be better?
How to: Navigator (Cont.)
 Think about what's going to happen next
 and prepare suggestions
 Write issues on paper or notebook, and
 discuss with driver when there is a break in
 action
 If a question arises:
 Find the answer while driver continues work.
 If finding the answer takes longer than 5
 minutes, do it together. Split up, pursue
 different paths of inquiry (e.g. do a spike)
 If still no answer, consider switching pairs.
Pairing Tips
 Pair on everything you’ll need to
 maintain.
 Allow pairs to form fluidly rather than
 assigning partners.
 Switch partners when you need a fresh
 perspective.
 Avoid pairing with the same person for
 more than a day at a time.
Pairing Tips (Cont.)
 Sit comfortably, side by side.
 Produce code through conversation.
 Collaborate, don’t critique.
 Switch driver and navigator roles
 frequently.
Good Luck!
 Pairing will be uncomfy at first
 Stick with it, and it will soon be more fun!
References
 Shore & Warden, 2008 -The Art of Agile
 Development . CA. O'Reilly Media Inc.
 J Donovan Wells, 2001 -
 www.extremeprogramming.org