Programming Fundamentals

Pair Programming

For pair programming you will buddy up with the person sitting next to you, and they will be your pair for this lab. Only one of you will be typing at any one time while the other person in the pair will watch.

How does it work?

Together, you need to read the exercise and discuss a plan for completing the exercise (hint: typing this plan out in comments in you code can be quite helpful). Once you’re both happy with the plan, one partner starts typing up your solution and the other person watches and gives feedback. This might be things like “you missed a semi-colon on line 7”, or “you need to initialise that variable to zero first”, etc.

When you are done with that lab exercise, make sure you add both of your names and zIDs into the header comment, or the lab might be considered plagiarism.

Sharing Pair Programming Code - In Person Classes

Both of you need to submit the code, so the “typer” needs to send it to the other pair. You can do this on CSE machines by doing the following:

scp file.c zXXXXXXX@login:~/file.c

You replace XXXXXXX with your partner’s zID, and file.c is replaced by the c file you are copying, ie. addition.c.

This copies the file to your home directory. You will need to move it to your lab folder and can do this with the mv command, eg. mv file.c lab02

Note that if you have a file by that name already, it will be overwritten.

Or you can send it to a specific folder. For example, if I have a lab02 folder on my desktop, I can send the file to that folder by doing:

scp file.c zXXXXXXX@login:~/Desktop/lab02/file.c

Make sure you are in the same folder as the file you want to share. You can check this by typing ls to see if the file is there.

When you enter this command you will be prompted for a password to be entered, so you should pass the keyboard to your partner to enter theirs. Note that you will not see the password being typed for privacy reasons, but it is being entered.

Make sure you have both students zID in the header comment of the file you are submitting.

Double check you have both submitted, and you’re done!

Sharing Pair Programming Code - Online Classes

Both of you need to submit the code, so the “typer” needs to send it to the other pair.

Write your code collaborativley in a replit file. Alternativley you can have one person share screen and send the code to the pair via Microsfot Teams after.

Copy the code into your your file on tigerVNC using copy and paste.

Make sure you have both students zID in the header comment of the file you are submitting.

Double check you have both submitted, and you’re done!