Pair programming: What to do when you're not holding the keyboard
In pair programming, usually only one person can type at a time.
Here are some suggestions for the other person:
- If you have a spare USB keyboard, plug it in and keep it handy.
That way you can switch with your partner without passing the keyboard
(a procedure I have always found awkward).
- If you're not holding a keyboard, hold a pencil and a piece of paper.
- Keep your lips moving.
If you understand what's going on, keep up a running commentary.
If you don't understand what's going on, ask questions.
So much for general advice.
Here are some things you should do, especially if you're
holding pencil and paper:
- If you're debugging and your partner is changing code, make a note of
other parts of the program (in the same module or in other modules)
that will have to be changed.
For example, if your program does arithmetic, and you decide the math
is wrong, if your partner is replacing ``old math'' with ``new math'',
make a note of all the other places you'll have to inspect for ``old
math.''
- If your partner is working the definition of a data structure, draw a
picture of it.
- If your partner is writing down a struct definition, insist on a short
same-line comment documenting each field.
- If your partner is working on an an algorithm, draw pictures of any
relevant data structures.
- If your partner is writing new code, or revisiting old code that
doesn't work, write down how to test it.