---
# System prepended metadata

title: CS200 Pair Programming Guide
tags: [resources]

---

---
tags: resources
---

# CS200 Pair Programming Guide

[TOC]

### 1.  What is Pair Programming?

Pair programming is when two people work together at a single computer.[^1] There's actually a good amount of research which has gone into studying the effects of incorporating pair programming into introductory and high-level CS courses!

### 2.  Why Pair Program?

There are several reasons why you should pair program:

  * You will produce better code [^3], [^4]
  * You will learn more, sharing your ideas with your peers and benefiting from their insights [^2]
  * You will become better at articulating your thoughts [^3]
  * You will enjoy your work more and spend less time frustrated [^3] [^4]
  * You will be better prepared for more complicated software engineering tasks, both in school and beyond, where collaboration is imperative to success [^2]

### 3.  How to Pair Program

There are two roles in pair programming:

**The Driver**
* Responsible for typing, moving the mouse, etc. 

**The Navigator**
* Responsible for reviewing the driver's work. In addition to catching incidental mistakes (which are tedious to track down when solo-programming), the navigator considers the code at a more strategic level: how will this fit with the rest of the code? Will this implementation require changes elsewhere? Could we design this program better?

Every fifteen minutes or so, the pair switches roles by sliding the keyboard over [^4] or an equivalent with a laptop. Here are some basic guidelines:

**Every fifteen minutes or so ..**
* You can wait for a natural breaking point[^3], but no one should drive more than 20 minutes or less than 10 at a stretch. 

**.. the pair switches roles ..**
* It's important that both partners spend an equal amount of time in each role. Some programmers may enjoy driving better, others navigating; however, each partner will gain valuable skills by spending time in both roles.

**.. by sliding the keyboard**
* Regardless of role, you are both working together on the problem at hand. As such, you should be seated next to each other with the monitor adjusted so you can both see the screen easily. All that's required when you switch is to push the keyboard a few inches this way or that.[^4] With a laptop, reposition the laptop (and yourselves if necessary!) to switch roles while ensuring you can both still see the screen clearly.

It is important to distinguish pair programming from another distinct cooperative division of labor: divide-and-conquer. In this latter strategy, two people responsible for completing a single task break down the task into smaller pieces, partition the resulting subtasks among themselves, and each works on "her part" separately. This strategy can be used successfully, but it should not be confused with pair programming.

### 4  Pair Programming Tips

Here, we outline various practices and perspectives that provide a foundation for your pair programming experience. Knowing that you and your partner have both read this, the two of you will have a common expectation about the pair programming experience and should be able to work together more effectively. These practices and perspectives are inspired principally by a well-written essay that programmers at every level are encouraged to read [^4] .

##### 4.1  Respect each other's time

Show up on time. Plan ahead--eat before you arrive. Don't text or check email during your pair programming sessions; stay focused on the joint task at hand.

Respect involves communication. If your partner is often late, bring it up. If you receive a call that you must answer, let your partner know and reschedule your meeting, acknowledging that you've inconvenienced your partner.

##### 4.2  Be a team player

Take collective ownership of the code you and your partner are writing, abandoning the notion of "my part" and "your part." And, in light of that view, make sure you speak up when you think an error's been introduced, and don't be too proud to admit a mistake. And finally, if you work on any code alone (for example, if a solution comes to you in a dream, or in the shower), review it together line-by-line before incorporating it into your program. Often it's useful for the two of you to rewrite solo code from scratch (you'd be surprised how many errors you can catch that way).

Again, communication is crucial. Perhaps you're having a hard time adjusting to pair programming, or your partner continues to say "my" instead of "our" work. Speak your mind and work through any problems. Offer to cease driving when it's time ("Hey, would you like a go at the keyboard?"), and remind your partner it's time to switch when you're navigator ("Mind if I drive for a while?").

##### 4.3  Be open-minded and light-hearted

One of the most important predictors of success in pair programming is buy-in: if you are determined to make the practice fail, it will. Choose a healthy perspective: laugh at your mistakes, apologize if you hurt your partner's feelings, and, more generally, look at pair programming as an opportunity to learn. Also, pair programming can be a pretty demanding activity, so take breaks when you need them. Perhaps a five-minute microbreak is all you need: to check email, get a drink of water, or catch some fresh air suffices. Or maybe you would like to take an hour off to get dinner.

##### 4.4  Seek advice when you need it

It's important to realize that you and your partner are not alone: if the two of you are having trouble working together, it's important to let an HTA or the professor know so they can provide further guidance. The HTAs and professors are familiar with the pair programming philosophy and the difficulties that may arise. They will be able to assist in conflict resolution and/or help you and your partner re-pair if necessary.

It is not acceptable in pair programming for a single person to do all (or even most) of the work and then add his partner's name. Academic honesty is always more important than fulfilling a pair programming requirement. If your partner is unwilling to help or fails to show up at scheduled meetings, or if your partner is unwilling or resistant to letting you contribute your share of the work, contact an HTA or the professor. Asking for help is not an inflammatory action, but an important step in conflict resolution.

### 5.  Pair Programming in CS200

Given enough eyeballs, all bugs are shallow.  
    --*Eric Raymond*

To summarize the collaboration policy included in the course missive:

  * In labs, you are required to pair program. Follow the methodology outlined in this document. Note that you are also required to program with a different partner each lab. 
  * On homeworks, you may not pair program. However, you are encouraged to talk about ideas with classmates; just don't take away notes from such brainstorming sessions. 
  * For projects, you must work together as a pair. Although you may not be coding, you are expected to follow the methodology outlined above; you may simply be sharing a notebook or a whiteboard instead of a screen. 
  * On exams and quizzes, no collaboration of any sort is permitted.

Therefore, your pair programming experiences will chiefly be in labs and on
projects.
 
## Tools for Pair Programming
### 1. Code With Me for IntelliJ
#### What is Code With Me?
Code With Me (for IntelliJ) is analogous to Google Docs (for docs) or Overleaf (for LaTeX). It lets up to 5 people work on the same project at the same time. You can all see each others' edits in real time, save to the same file, and run and debug the program together. There are even video chat and other features if you want to make use of them. You can download the plugin [here](https://plugins.jetbrains.com/plugin/14896-code-with-me)

#### How to Host a session, in pictures
![](https://i.imgur.com/PeVJJIU.png)

![](https://i.imgur.com/i0d2JOt.png)

![](https://i.imgur.com/bxkiXEB.png)

![](https://i.imgur.com/PG1vdK8.png)

![](https://i.imgur.com/kQ84egA.png)

#### Following and Syncing
![](https://i.imgur.com/Kkb18JS.png)

Following automatically scrolls your screen to match who you're following. Full sync is ideal for pair programming, because it brings your cursor to the exact same spot and follows across multiple files. This doesn't work perfectly always with 3 people, but play around to see what feels bests and and make sure to switch who's typing!

### 2. Zoom remote control
If Code With Me isn't working or you just want to use Zoom, you can make use of giving/requesting remote control to let all people edit code on one person's computer. It's a simple screen share option; see a guide to it [here](
https://support.zoom.us/hc/en-us/articles/201362673-Requesting-or-giving-remote-control).

---
*Please let us know if you find any mistakes, inconsistencies, or confusing language in this or any other CS200 document by filling out the [anonymous feedback form](https://forms.gle/xVYoEsz4KqGkBH3B7)!*

<!-- References -->

[^1]: Extreme programming:  A gentle introduction. http://www.extremeprogramming.org/,August 2007.

[^2]: Jennifer Bevan, Linda Werner, and Charlie McDowell. Guidelines for the use of pair programming in a freshman programming class. *In Proceedings of the 15th Conference on Software Engineering Education and Training (CSEET’02)*, Covington, KY, USA, February 2002. IEEE.

[^3]: Laurie  Williams,  Eric  Wiebe,  Kai  Yang,  Miriam  Ferzli,  and  Carol  Miller.   In  support  ofpair programming in the introductory computer science course. *Computer Science Education*,12(3):192–212, 2002.

[^4]: Laurie A. Williams and Robert R. Kessler.  All I really need to know about pair programming I learned in kindergarten. *Communications of the ACM*, 32(5):108–114, May 2000