EBoard 07 (Section 2): Pair Programming
Approximate overview
- Administrative stuff [~35 min]
- Questions [~5 min]
- Discussion [~40 min]
Administrivia
Introductory notes
- I hope you had a pleasant “work differently” day.
- Today is a “teach differently” class. It will be mostly discussion,
with no on-computer lab.
- Please say your name when you ask or answer a question (even if I’ve
just called you by name).
- Evening tutors are available 7–10 p.m. Sunday through Thursday.
- Mentor sessions are Wednesday, 8–9 p.m., Sunday 4–5 p.m., Monday 8–9 p.m.
- No Mentor Session next Wednesday (SoLA 1)
- Note that 02-05-2022 is an ambiguous date, as is 02/05/2022.
I much prefer that you use the unambiguous YYYY-MM-DD format.
- When you need to finish a lab outside of class, and can’t get a
problem in a reasonable amount of time, it’s okay to say “This is
as good as I could do”.
- Do not divide work on labs! Both partners should be working
together on all the problems.
Attendance / Mispronunciations
- Sam has names in random order.
- When you hear your name, say your name again and say how you used your
Learn Differently Day.
Racket notes / Debrief from last lab
- Apologies for the
median-of-three? vs median-of-three issue.
- Please do not put your
lambda on the same line as your define.
- Please do not cram stuff together. Always have a space between
a procedure and its parameters. No
(+(- 2)3) or anything like that.
- Please limit the length of your lines and the number of “words”
on a line.
- “Please” is short for “If you ignore me, you will likely lose points.”
Zen of Booleans
- Aspect one: Avoid explicit
#t and #f.
(if TEST #t #f) is a long way to write TEST
(equal? TEST #t) is also a long way to write TEST
- Aspect two: Use
and and or instead of if and cond
Example
(define non-integer-number?
(lambda (x)
(cond
[(integer? x)
#f]
[(number? x)
#t]
[else
#f])))
(define non-integer-number?
(lambda (x)
(and (number? x)
(not (integer? x)))))
Different ways of thinking
; The cond version
(define median-of-three
(lambda (x y z)
(cond
[(or (<= x y z) (<= z y x))]
y]
[(or (<= x z y) (<= y z x))]
z]
[(or (<= y x z) (<= z x y))]
x]
[else
(error "math makes no sense")])))
; The nested-if version
(define median-of-three
(lambda (x y z)
(if (<= x y)
(if (<= y z)
y
(if (<= x z)
z
x))
(if (<= x z)
x
(if (<= y z)
z
y)))))
; The mathy version
(define median-of-three
(lambda (x y z)
(- (+ x y z)
(min x y z)
(max x y z))))
; The minmax version
(define median-of-three
(lambda (x y z)
(min (max x y) (max x z) (max y z))))
Sam’s tests
(test-equal? "in order" (median-of-three 1 2 3) 2)
(test-equal? "in reverse order" (median-of-three 10 3 1) 3)
(test-equal? "median first, largest last" (median-of-three 4 2 5) 4)
(test-equal? "median first, largest second " (median-of-three 5 8 1) 5)
(test-equal? "median last, largest first" (median-of-three 11 5 6) 6)
(test-equal? "median last, largest second" (median-of-three 1 11 7) 7)
(test-equal? "all equal" (median-of-three 8 8 8) 8)
(test-equal? "first two equal, third larger" (median-of-three 9 9 10) 9)
(test-equal? "first two equal, third smaller" (median-of-three 0 0 40) 0)
(test-equal? "last two equal, first larger" (median-of-three 3 1 1) 1)
(test-equal? "last two equal, first smaller" (median-of-three 0 2 2) 2)
(test-equal? "outside equal, first larger" (median-of-three 3 5 3) 3)
(test-equal? "outside equal, first smaller" (median-of-three 4 2 4) 4)
(test-equal? "fractions" (median-of-three 1 2 3/2) 3/2)
(test-equal? "includes negatives" (median-of-three 3 -4 11) 3)
(test-equal? "all negative" (median-of-three -3 -5 -4) -4)
TPS = “Think, Pair, Share”
TLA = “Three Letter Acronym”
Which do you prefer? Why? (TPS)
- cond (6)
- Easy to read and understand
- It’s longer. (That’s worse.)
- nested if (0)
- Possibly the most efficient
- Job security
- mathy (6)
- Clever
- Nice to see something different than what I’d done
- minmax (lots)
- Really simple
- Nice to see something different than what I’d done
- Original was wrong (which means Sam forgot to run the tests)
What hasn’t Sam tested? (TPS)
- Sam forgot to test inexact numbers.
- Sam forgot to test the minmax version.
- We didn’t check complex numbers, but we can’t compare complex
numbers using <.
Gradescope notes
- Gradescope doesn’t let us give categorical grades, so you get numbers.
- For S/N, S is 1 and N is 0.
- For E/M/R/I, E is 3, M is 2, R is 1, I is 0.
- For everything, the autograder scores have no effect (other than to see
what you might have had problems with).
- We’ll look at how you check grades on Gradescope.
Upcoming work
- Quiz 3 Friday: Conditionals
- Readings for Friday due Thursday at 10:00 p.m.
- Lab writeup from today due Thursday at 10:30 p.m.
- Do this individually out of class.
*It’s short.
- Mini-Project 2 due Thursday at 10:30 p.m.
- On Gradescope
- Autograder is live; I think it’s bug-free.
- Mini-Project 1 redo due Sunday the 20th at 10:30 p.m.
- SoLA 1 due a week from Thursday at 10:30 p.m.
About SoLAs
- A SoLA has a bunch of questions very much like the quiz questions.
- You get an hour for each question. It’s designed to take 10–15
minutes.
- If you get a question right, you’ve checked off one of the learning
goals.
- If you have credit, please don’t try it again on future
SoLAs.
- If you don’t get a question right, you can try again on the next SoLA.
- And you should talk to someone in advance to make sure you
understand what you didn’t understand.
- I add seven new learning goals on each SoLA (except SoLA 5).
- You can see the learning goals on the LAs link at the top of each page.
- You can also see a sample set of questions for the first SoLA.
- You may use DrRacket, your notes, the Course Web site, and the
Racket documentation. You may not use other people for help, nor
may you search the Interweb.
- Released Wednesday at 2:30 p.m., due Thursday at 10:30 p.m.
- There are no mentor sessions on nights during the SoLA.
- Sam will not generally answer questions on the SoLA (but will fix bugs).
Sample Quiz Question
Utilize boolean expressions and values in a program to produce conditional behavior.
As you know, we often associate words with students’ standing in
college. At Smileyville College, Those who have completed fewer
than four terms are “freshlings”, those who have completed between
four and seven terms (inclusive) are “wise fools”, those who have
completed between eight and eleven terms (inclusive) are “subordinates”,
and those who have completed at least twelve terms are “elders”.
Write a procedure, (status terms), that, given the number of
terms a student has completed as input, produces a string that
describes the student using the terms above.
Upcoming Token-Generating Activities
- Mentor sessions.
- Grinnell Lecture, Thursday, 11am
- Track & Field, Darren Young Invite, Saturday, 10am
Other Upcoming Activities
Questions
From the readings
There weren’t many questions on these readings.
Are you one of those professors that allows us to leave group
members’ names off of projects if their contributions were
unsatisfactory? Or do you prefer to move around group members?
Your primary group projects will be labs. They are small enough
that I don’t think it’s an issue.
Our bigger worry is partners who plow ahead without making sure
that their partner contributes / understands.
In both cases, you should talk to me (or a mentor).
What happens if our lab partners are unwilling to meet outside of
class to finish a lab?
You can finish the lab separately. But I’ll try to make sure
that most labs are finished in class.
If I’m sitting at a lab with a partner, and have no clue what I am
doing how should I work to be useful, while also being involved
with the lab?
Ask questions.
Obligatory story.
Questions I’m not answering out loud
Who writes the autograders?
I do. I’m rewriting all of them this semester.
How long does it take you?
It varies. Usually about an hour for a lab and longer for a mini-project.
In most cases, I also do (or re-do) the lab or mini-project, which adds
additional time. The MP2 autograder + answers + fixing took me about
three hours.
Other questions
On the mini project, if we have procedures that reutun other than true or false, what should we write?
Prefer: (test-true "comment" (equal? (your-proc params) expected-value))
Alternate: (test-equal? "comment" (your-proc params) expected-value)
Do redos replace the prior grade?
Yes.
Do I need to spend a token for an MP redo?
No if it’s the first redo and you got an R or an M.
Yes if it’s the second redo or you got an I or an E.
Is there a third redo?
No.
If you get an R or an M and follow all the comments, will you get an E?
Usually/ideally.
Pair Programming Pursued
The introductory material took long enough that we skipped this section.
Discuss with your partner and be ready to answer.
- What did you find surprising in the readings?
- What outstanding questions do you have about pair programming in
CSC-151?
Surprising
Questions
Pair Programming in Practice
- You should have received a card from Sam or one of the mentors.
- These represent approximate quotations from past CSC-151 students
(anywhere from midway through the semester to a few years after
they took CSC-151).
- I will ask you to read them aloud so that you hear them in the
voices of students.
- Listen carefully for comments that resonate or that you’d like
to discuss further.
- We will think, pair, and share.
- There’s an individual lab for you to fill out.
- There were a lot of comments about partners who are not letting their
partner contribute.
- Please try not to be that partner.
- Encourage your partner to contribute, if possible.
- There are issues of when a partner doesn’t think they know what they’re
doing.
- Remember the story about Sam’s students; you can always contribue
and learn.
- Don’t undermine your partner’s confidence.
Other thoughts
- We don’t always judge our partner’s skill level well. (They may not
even judge their own skill level well.)
- We benefit from shared knowledge if we accept that we have shared
knowledge.
- Accept the slower pace / different work if your partner is not as
knowledgeable.
- You are not alone; others feel the same way you do.
- There are some real benefits to pair programming; let’s make sure we
can take advantage of them.
- Having someone there in case you get stuck.
- Different ways of thinking.
- Someone to high-five.