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
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 z5555555@login:~/file.c
You replace 5555555
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 z5555555@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.
Double check you have both submitted, and you’re done!
Note that while only one exercise specifies you need to program in pairs for it, you can do it for all the 1 dot and 2 dot exercises if you want to!