Skip to main content

CSC 151.01, Class 06: Pair programming

Overview

  • Preliminaries
    • Notes and news
    • Upcoming work
    • Extra credit
    • Questions
  • Basics of pair programming
  • Benefits of pair programming
  • Exercise
  • Forming a code of conduct
  • Assorted other issues

News / Etc.

  • New places/partners!
  • I need to leave a few minutes early today. I apologize.

Upcoming Work

  • Writeup for class 5 due TONIGHT at 10:30 p.m.
  • Flash cards for classes 1-6 due TONIGHT at 8:00 p.m.
    • To: rebelsky@grinnell.edu
    • Subject: CSC 151-01 Flash Cards Week 2
    • We’ll talk about them at the end of the preliminaries.
  • Writeup for class 6 due Friday at 10:30 p.m.
    • Q1: One new thing you learned about pair programming today.
    • Q2: Something you’d like to see in the class code of conduct.
    • To: csc151-01-grader@grinnell.edu
    • Subject: CSC 151.01 Writeup 6 (YOUR NAMES)
  • Assignment 3 due next Tuesday.
    • Your partner from today’s class is your partner for the assignment.
  • Read: Documenting your procedures for Friday’s class. (Not yet ready.)

Extra credit (Academic)

  • Convocation, Thurday at 11:00 a.m. in JRC 101: The Des Moines Agricultural Corridor.
    • Why you should attend every convocation.
  • Rosenfield symposium, this week. (Lots of different events)
    • Jason Reblando, photographer and author, describing “New Deal Utopias,” at 4 p.m. TODAY in JRC 101.
    • Alan Durning of Sightline Institute, stressing “The Power of Small: How Building Small Means Living Large,” 7:30 p.m. TODAY in JRC 101
    • Shu-Yang Lin, re:architect at Public Digital Innovation Space, presenting “Democracy from the Future: Taiwan” at 4 p.m. Thursday, Sept. 7 in JRC 101.
    • Tom Vilsack, former Iowa Governer, “Food as a Political Movement that Unites but Does Not Divide” at 7:30 p.m. Thursday, Sept. 7 in JRC 101.
  • Concert Thursday at 7 pm in Sebring Lewis.

Extra credit (Peer)

  • Women’s Soccer vs. Central, TODAY at 5:00 p.m., Springer Field
  • Les Duke Cross Country Meet, Saturday at 9 a.m., Country Club
  • Women’s Tennis vs. Beloit and Lake Forest, Saturday at 9 am Fieldhouse
  • Men’s Soccer vs. North Central College, Saturday at 1:00 p.m., Springer Field
  • Women’s Soccer vs. University of Wisconsin-Oshkosh, Sunday at 1:00 p.m., Springer Field

Extra Credit (Misc)

  • Host a prospie.

Other Good Things

Flash Cards

What’s a flash card?

  • A simple study aid.
  • A short question on one side; a short answer on the other.

Examples

  • “Scheme for add 2 and 3” => (+ 2 3)
  • ”(+ 2 3)?” => 5
  • “Typical lambda form” => (lambda (x) expression)
  • Parameters to reduce => binary operation, list of values.
  • Purpose of reduce => Reduce all the values in a list to a single value by combining neighboring values with the binop.
  • (reduce + (list 1 2 3)) => 6
  • reduce vs map1 => Same parameters. reduce reduces to single value by combining neighboring terms. map makes another list.
  • Seven parts of algorithms => Basic ops, variables, subroutines, conditionals, etc.
  • Four questions about each new type => …

Background

  • For a number of years, I’ve recommended that students use flash cards to study for CSC 151.
  • This summer, I participated in a workshop on using Cognitive Science principles in the classroom. That workshop presented evidence that flashcards are one of the more successful ways that students learn.
    • Low impact quizzes are another.
  • So I committed to requiring flashcards in this class.

Your task

  • Create at least ten flash cards for the past week (Friday, Monday, Wednesday) and turn them in by 8:00 p.m. on Wednesday night.
  • I would prefer that you create an Anki deck and download it and email it to me.
  • If you would prefer to give me a stack of ten physical flash cards at the end of class, or to email me a list of ten questions/answers.

Questions

I could not figure out how to bound all of the values in a list. What
should I have written?
Hint 1: We know that to bound a single value, we use (min (max val 0) 100)
Hint 2: If we are using max on every element of a list, we probably need a second list since max expects two values. (map max values some-other-list)
One approach: (make-list 11 0) => (map max values (make-list 11 0))
Generalize: (make-list (length values) 0)
I can do something similar to get rid of the really large numbers.
> (map min
       (map max values (make-list (length values) 0))
       (make-list (length values) 100))
'(0 4 1 30 100 82 0 6 23 100)
> values
'(-3 4 1 30 10000 82 -5 6 23 101)
Since I couldn’t figure it out, what should I have done for the writeup?
Use “we” rather than “I”.
“Here’s the best we could come up with. It didn’t work.”
Why won’t index-of work?
I don’t know.
You needed to (require csc151/lists)
You needed to have updated the package recently
I’ll look at one of your workstations during class.
How do we update the package?
Open the package manager in DrRacket.
Type the URL of the package https://github.com/grinnnell-cs/csc151 (or something like that)
Click Update
Threaten to defenstrate your computer

Basics of pair programming

Suppose the rest of the class had not done the reading. Explain.

  • Two programmers work in a team.
  • Sometimes at two levels of abstraction: One thinking about the code, some at a higher level.
    • I think we should add two to each element of the list
    • Okay, (map (section + <> 2) lst)
  • We call the person at the keyboard the driver and the one providing guidance navigator.
  • Note that writing the code is really important, but that it’s equally important to contextualize it.
  • The navigator can also help the driver by, say, looking up the syntax or semantics of the operations the driver needs.

Benefits of pair programming

Suppose the rest of the class had not done the reading. Suggest benefits.

  • Some evidence suggests that you get greater productivity in pairs.
  • If we are too focused, we may miss some opportunities or potential problems or …
  • Therefore your code works better.
  • You have an obligation to your partner, an incentive to get the work done.
  • Talking out your code is a benefit, even if you describe it to a potted plant.
  • Meet new people. They are Grinnellians! Good odds you get to meet someone awesome.
  • Learning to work with different kinds of people is important.

Exercise

Our mentors have distributed cards with simulated quotations from past CSC 151 students. Please read your cards aloud.

Additional question from Sam: How do you interpret the following: “I thought we were working well together. Then my partner asked me out.”?

If you are working with someone who seems a bit different (however), you should try to adapt.

What do we do about people who think they have more knowledge or who
think they are better and who therefore decide to look down upon their
partner?
Find ways to learn from them.
You can learn from helping.
Tell your partner that they are being condescending.
Tell the mentors that your partner is being condescending.
Empower yourself and your partner by explaining.
What do you do about negative or positive prior relationships?
Be more open.
Partnering gives many benefits.
Two people reading Sam’s bad instructions is better than one.
Two people can commiserate over how much work Sam gives
Two people can celebrate together
Normal for people to want to work alone. But working together is really
what we’ll have to do for the future.
We should accept it.
We should learn to cooperate.
We should be incredibly thankful to Sam for giving us this opportunity.

Forming a code of conduct

I treat my partner with respect, whether they are like me or different me. I acknowledge that my partner has strengths.

Assorted other issues

A chance to talk about leftover things.