Last Updated: February 25, 2016
·
2.599K
· garrick

Pair Programming Cheat Sheet

Pair Programming is very powerful and often very misunderstood. I highly recommend reading Pair Programming Illuminated (http://www.amazon.com/Pair-Programming-Illuminated-Laurie-Williams/dp/0201745763) as a starting point. As you begin to get a feel for pairing, review these tips. They're a combination of ideas from Pair Programming Illuminated and my own personal experiences pairing on production code for multiple internal projects and customer facing products over several years.

Observe that your getting the most out of the 7 Synergistic Behaviors:
Pair Pressure - Positive encouragement: not wanting to let partner down + satisfaction of working harder & smarter than alone.
Pair Negotiation - combining two sets of skills for design & implementation yielding the best solution that fits.
Pair Courage - advantage of not being alone in a challenging task, trying together what one may not alone.
Pair Review - the continuous review of design & implementation that happens in context and is more likely to be acted upon.
Pair Debugging - going from problem identification to fix in a more enjoyable and often far shorter path than by an individual.
Pair Learning - acquiring and/or improving skills while delivering value through working with another.
Pair Trust - each individual becomes more confident in their skills and communication to present their best ideas as they feel supported.

If you find these synergies are weak or lacking, reflect on what you can do to improve your pairing experiences.

Pairing Games:
“Ping Pong” - Typically for Test Driven Development
1.) Driver creates test class and/or initial failing test with navigators’ help
2.) Switch roles!
3.) New driver makes test pass with new navigators’ help
4.) Pair negotiates possible refactoring and code check-in, does so if agreed
5.) If not ready to take a break, Goto #1

“Beat the clock” - A good way to enforce pace and limit keyboard hogs
1.) Grab a physical or virtual timer (Smart Phone, System Tray Application, etc.)
2.) Decide who will be the driver first
3.) Set the timer & let the driver get as far as they can with the navigators’ help.
4.) Switch driver & navigator, repeating until you need a break

“Freeform” - For advanced pairing practitioners
1.) Someone starts driving
2.) Roles are switched as the pair feels needed so long as Synergies don’t stop

Pairing Script:
1.) Decide on a Story & Task
2.) Decide initially on how much you want to pair (time spent and/or progress)
3.) Decide initially on a Pairing Game to use
4.) Play your Pairing Game
5.) Decide to continue (goto #1), switch pairs, or stop

Pairing Dialogue:
Try the following:
Saying “I think...” to propose an idea.
Asking “Do we agree...” to confirm agreement
Saying “We agree...” to discuss progress towards goals
Avoid saying “No” / ”But”. Instead try saying, “Yes and...”
Ask “What would it take to get you in..” if you’re disagree about a proposed idea

Check your 4 “C”’s:
Communication: Do you agree you’re both communicating well with each other?
Comfort: Are you two both comfortable with the context you’re working in?
Confidence: Are you confident in your skills and your teams’, or at least voiced fears?
Compromise: Are you willing to make compromises in order to make progress?

Pairing Mechanics:
1.) Turn on line numbers in an IDE or text editor if available. It makes it easier for the navigator and driver both to reference sections of code in discussion.
2.) ASK for mouse/keyboard control, don’t fight!
3.) Remember to point with your mouse, not at the screen when using mirrored monitors.
4.) Remote pairing should not only be desktop sharing & voice. A significant portion of human communication is nonverbal, so add video chat to your tools.