Pair Programming in CS111*

*Much of the content in this page is adapted from the National Center for Women and Information Technology site.

Pair programming basics

When working on programming assignments, whether in lab or elsewhere, you will often use the “Pair Programming” approach. In pair programming, two programmers share one computer (note: this can also be done remotely using Zoom's remote control feature). One student is the “driver,” who controls the keyboard and mouse. The other is the “navigator,” who observes, asks questions, suggests solutions, and thinks about slightly longer-term strategies. The two programmers switch roles about every 20 minutes. Working in pairs should make you much better at programming than would working alone. The resulting work of pair programming nearly always outshines that of the solitary programmer, with pairs producing better code in less time.

Work usually gets done twice as fast when partner programming than when working alone, because generally you have to agree that the idea is a good one before you move forward with it.
-- former CS111 student

Working with a partner

Problem set tasks are labeled either as individual tasks or partner-recommended tasks.

For a partner task, the teams must have exactly two members. Teams with three or more members are not allowed.

When you work with a partner, you will need to arrange times to meet outside of class. The most important rule of pair programming is that code is written in real time together (e.g., partner A's individually-written code cannot be passed onto partner B, instead both partners write code together). Such programming can either be done in person at a single physical computer or via Zoom where one person is sharing their computer with their partner. (Zoom's remote control feature offers the advantage of easily supporting the driver/navigator model that is essential to pair programming because both partners can edit the code directly. One partner should open up a window with the particular task and then allow access to the remote partner to control that window.)

We expect everyone to be flexible and professional in arranging meeting times as necessary; if your schedule is highly constrained, explore possible meeting times with your prospective partner before you commit to the partnership.

How to pick your partner

You should try to pick a partner whose experience and skill level with programming is similar to your own. This may not always be possible and it is sometimes hard to compare skill levels, but students tell us (and other data support) that pairs are most productive when the partners start at about the same level. Still, people often pair up with another whose skills are different. This happens regularly, as no two people have an identical skill set. The differences may be great or small, but this is exactly like most real-world working situations. Part of accomplishing a task is to get the most out of each member and make each member stronger and more productive on subsequent tasks. Students bring different strengths to the process, regardless of how much experience they have had with programming. Both experienced and inexperienced students will need to draw on their reasoning and problem solving skills. A more experienced partner may sometimes feel frustrated or slowed down by a less experienced partner, but the experienced partner still benefits from the teamwork in many ways. The less experienced partner’s requests for clarification often uncover flaws in an approach or solution; the exercise of providing a clear explanation solidifies and deepens the explainer’s own understanding and the teamwork and communication skills they gain have great value in both the academic realm and the job market.

Sometimes my partner would come up with an idea to solve a bug that I'd never thought of, and sometimes it was the other way around, and it made me notice which areas were my areas of weakness. Discussing with a partner to find solutions was central in my understanding, and I enjoyed it more than individual tasks. Having someone else to enhance your learning and to supplement some gaps in knowledge was a great experience.
-- former CS111 student

The less experienced partner may feel that questions hold the other partner back or that there is no benefit to participating actively, but pair programming studies show that paired work is consistently better than work the stronger partner does alone. It is each partner’s job to understand the whole task; that means asking questions when necessary and answering them when possible.

Dealing with differences

If you believe your partner is not participating appropriately in pair programming (e.g., they often do not come to lab, do not keep in touch, or do not come to lab prepared to work) please first address your concerns to your partner, and try to agree on what should be done to make the pair programming experience work well for both of you. If that approach is not successful, explain the issues to one of your instructors, who will work with you and your partner to improve the situation.

How pair programming affects your grade

Failure to participate respectfully and cooperatively with your partner during lab will affect the participation component of your course grade.

Watch this short video (< 3 min): Pair Programming (Code.org)

The video explains the important roles of "driver" and "navigator" -- you and your partner should switch these roles often.

Seek clarification

Pair programming is shown to help, not hinder, your successful completion of the introductory course. It is important that you understand the processes and expectations up front so you can gain the most benefit. If you are unsure of any of the aspects of pair programming and how it is implemented in the course, see your instructor right away.