Skip to main content

Class 15: Test-driven development (TDD)

Held:

Preliminaries

Updates

News / Etc.

  • I’ve seen two different guidelines on when this class runs. One guideline says that it’s the first seven weeks of the semester. The other says that it’s until spring break. Do you have preferences? (I will also ask CSC 322.)

Upcoming work

  • For Monday, read SaaSbook Chapter 9 and sections 10.4-10.9 (Yes, there is a writing journal.)
  • If you have not completed the Sinatra homework, continue working on it.

Good things to do

  • Diving today at 2pm.
  • Jazz band tonight at 7:30 pm.
  • Screenagers documentary, 10 am, Saturday, Strand
  • Met Opera Live in HD showing of Rusalka, Saturday, Feb. 25. Talk 11:30-noon, opera noon-3pmish.
  • Diving tomorrow at noon.
  • CS Table, Tuesday at noon: ???
  • W. Kamau Bell, Tuesday at 6pm, Harris.
  • Prazak Quartet, Tuesday, 28 February 2017, 7:30 p.m., Herrick.
  • CS Extras, Thursday at 4:15 pm, Summer Code Camps

Refresher: Incorrect code

What does this program try to do?

class TimeSetter
  def self.convert(d)
    y = 1980
    while (d > 365) do
      if ((y % 400 == 0) || (y % 4 == 0) && (y % 100 != 0))
        if (d > 366)
          d -= 366
          y += 1
        end
      else
        d -= 365
        y += 1
      end
    end
    return [y,d]
  end
end

What is wrong with this program?

How would we find it?

How would we fix it?

Loop invariants

  • The CSC207 part of my brain wants you to fix this with loop invariants.
  • So let’s remember what loop invariants are. Three main aspects.
  • How would the help with this program?

Global Surveillance

“I would like to discuss the idea of global surveillance and where to draw the line. It’s a grey area for me and I’d like to get more opinions on it.”

  • Arguing for as much surveillance as possible: MG, CG, NT, AH, SH, YL, EZ, GN
  • Arguing for a moderate position: ST, RW, BR
  • Arguing for none whatsoever: Everyone else.