Pair Programming

Pair programming is a way to program collaboratively with a partner. It's a great approach when you're learning how to program, plus it's used by many companies in the tech industry.

In pair programming, partners are working together at the same time. One partner is the "driver," who actually types the code. The other partner is the "navigator," who observes, asks questions, suggests solutions, and thinks about slightly longer-term strategies.

It's very important for partners to switch roles throughout an assignment, either every 10-20 minutes or alternating each problem.

Pairing Setup

Pairing in Person

This is the traditional approach to pair programming. Partners sit together at the same computer, ideally one with a large or double monitor. The driver controls the keyboard and mouse, while the navigator looks at the code and assignment description.

Remote Pairing

Fortunately, it is also very possible to do pair programming online, thanks to the wide range of collaborative cloud applications.

You'll need two things:

  • A way to hear each other.
  • A way to share code and the command line.

For hearing each other, you can set up a Zoom call, Google Meet, or Discord call.

For sharing code, you can follow the instructions for the VS Code editor.

You'll generally want to both be using the same editor, so you'll either want to find a partner using the same editor or be willing to try a new editor. That can be a part of the learning experience, too!

There are also online editors that support collaboration. Our own code.cs61a.org includes a sharing option. Another option is Repl.it, as long as you use private repls (learn how to get a free account). In both cases, you will still need to run the Ok commands on your computer.

If for some reason you're unable to do actual pairing in an editor, you can always fall back to a shared Google Doc. Just make sure to turn off the auto-correct in your document, or your code will get infused with new and exciting syntax errors.

Pairing FAQ

When is pairing permitted?

We encourage pair programming in projects. You're also permitted to pair program on a lab problem, especially if you are stuck. Just make sure that you are always alternating between roles so that you are both learning from the experience. You should not be pair programming on homework assignments, however, since you are required to write your own code for them.

See the course policies for more information.

Finding a partner

We recommend finding a partner in your tutorial group, but course staff will also provide a partner matching form at various points in the semester. Keep your eyes peeled for a Piazza post announcing the partner matching form.

You're not required to have the same partner for every project. Pair programming is as much about communication styles as it is about coding styles, so it's important to find a partner that you are able to communicate well with.

How do we submit/get grades as a pair?

For non-project assignments, you should submit your work individually.

If you're working on a project together with a partner, only ONE of you should needs to submit the assignment to Ok. Once the assignment has been submitted, you must then add your partner by inviting them by email. Make sure to accept the invitation or the partnership won't be official. See Using Ok for more information.

What are the expectations of each partner in a pair?

We expect partners to communicate with each other, arrange times to meet for pairing, and participate equally in the process of pair programming. If one of you would like to work separately on particular parts of a project, you should communicate that with your partner.

NOTE: If you agree verbally (or via email) to work with a given partner on a given assignment, you are expected to work through that assignment with that partner to completion. You can't abandon your partner in the middle of an assignment unless the decision to unpair is mutual for both of you. Please be considerate for your partner and don't leave them hanging without an easy way to find a new partner in mid-assignment. If you are planning to end your partnership and do the next assignment alone, please tell your partner this as soon as possible when the assignment is given out, so that they can make other arrangements.

My partner and I didn't work well together...

We sometimes see feedback like:

My partner didn't do any work, or didn't do their share of the work, or didn't communicate or meet with me, etc. What can I do?

Or:

My partner did too much! They hogged the keyboard, or they did the whole assignment without waiting for me, or they didn't communicate with me, etc. I feel that I didn't get a real chance to help in solving the assignment. What can I do?

Have you tried speaking to your partner about your expectations beforehand? Many group issues can be resolved by better communication and setting expectations.

If talking to your partner does not resolve the situation, speak to course staff and explain the details of what has happened. We will try to help you resolve the issue. If it is an ongoing problem, staff can help you find you a partner or allow you to dissolve your partnership and submit individually.

How do we get help if our pair is stuck on an assignment?

You can go ask for help from the course staff in office hours. We ask that only one of you enqueue for help at a time. That is, please don't try to "double up" by enqueuing both of your names in the line. If we find that a pair is doing this, we will remove both of their names and move one of them to the very back of the queue. Thank you for your cooperation.