A guide to pair programming #
One of the goals of this class is to make you a better software engineer. Something software engineers often do in the real world is pair programming, which you will be doing through this course’s labs!
What is pair programming #
Pair programming is a system in which two programmers (you and a partner) collaborate using a single device. In traditional pair programming, the two programmers sit next to each other in front of a single keyboard and monitor. One programmer “drives” (types code on the device), and the other “navigates” (reviews code, looks out for bugs, suggests how to move forward).
Pair programming has been shown to improve your code by decreasing the number of mistakes in your code, enabling you and your partner to effectively share knowledge, and making your code cleaner and more efficient overall. Also, two heads are better than one.
You and your partner take turns being the driver and navigator. For CS51 labs, you should switch roles after every exercise. Importantly, both partners should be engaged at all times and in constant communication. The more experienced person should spend more time navigating, so as to give the less experienced person more experience writing code and so as to force themselves to slow down and explain concepts to the less experienced person.
How to pair program over Zoom #
In an in-person setting, you would be working on one person’s computer and high-fiving your partner after every exercise. On Zoom, you might not be able to do that. Here’s what you can do instead.
Method 1: Screen Sharing #
One way to pair program is for one person to share their text editor and terminal window on Zoom. The other person can also request remote control of the sharer’s screen so both people can take turns driving and navigating.
Method 2: Collaborating Live #
Another (perhaps more pleasant) way to pair program is to collaborate synchronously on one file (like Google Docs, except we strongly recommend against actually using Google Docs for code). In the spirit of sticking to the pair programming principles though, do try to make sure only one person drives at a time.
Collaborating Using VSCode #
One editor that allows for live OCaml collaboration is Visual Studio Code.
Follow the instructions in the Programmers’ editors guide to install and configure VSCode for OCaml development.
To collaborate with others live, click the “Live Share” button in the bottom left corner. You should then be prompted to sign in via a popup in the bottom right corner. Some options should then pop up in the search bar at the top of the application window, from which you should choose “Sign in with GitHub” and proceed to sign in with GitHub. If you get an error or are not prompted to sign in, search “Sign in” in the top search bar and then sign in with GitHub.
You should then get a popup saying “Invitation link copied to keyboard!” (and some other stuff). Click “Copy Again” to copy, paste, and send the link to anyone you’re collaborating with. After that popup disappears, you can still copy the link by going to the Live Share tab (bottom-most button on the leftmost sidebar) and then clicking the little clipboard next to “SESSION DETAILS” at the top of the second-from-left sidebar. You can also find the link on the
vsliveshare-welcome-page
tab of your main workspace.To run files and code, click View -> Terminal from the top menu (top of your computer, not part of application window) to pull up an integrated terminal. It should initialize the working directory to the top level of your repository (where “your” is the person who is sharing their workspace).
If you would like to join someone else’s workspace, click on the link they sent you.