g CS151

CS 151

Cover page image

Cay S. Horstmann

Lecture 3

Lecture 3 Clicker Question 1

Is the value 42 an object?

  1. Yes
  2. No, it has no state
  3. No, it has no behavior
  4. No, it has no identity

Lecture 3 Clicker Question 2

Consider designing a system where students can take online quizzes such as this one? What would not make a good class?

  1. Student
  2. Question
  3. EvaluateResponses
  4. WrongAnswer

Lecture 3 Clicker Question 3

In the voice mail system, consider the responsibility:

Remove a message from a mailbox

Which class should be responsible?

  1. Mailbox
  2. User
  3. Message
  4. MessageQueue

Lab

The Lab Report File

  1. Scribe: Make a directory to hold your lab work and put an empty file in it.
    cd ~/cs151
    mkdir lab3
    touch lab3/report.txt
  2. Make sure it's lab3 with lowercase letters and no spaces. Now open the file in your favorite text editor.
  3. Coder: Also make such a directory. This is a non-coding lab, but we'll do work on paper. Take photos and put them in your repo. (You can do this later.)

A Piazza Simulation

We want to design a program that simulates Piazza in the same way that the voice mail simulation simulates a real voice mail system.

Jointly come up with a list of classes that you think will be needed.

Scribe: Write down the classes that you came up with

Scenarios

Think of the key scenarios that are happening in Piazza. One of them is: “Student asks a new question”. Write down other scenarios that are useful and that one might want to include in the simulation. (Stay away from complicated stuff like adding images or HTML editing.)

Scribe: Write down the scenarios that you came up with

CRC Cards

Make a CRC card for each class that you discovered. Start playing through the three most interesting scenarios. Which classes are responsible for what?

For example, consider “Student asks a new question”. Do you have classes Student and Question? A class that manages a list of questions? Which class is responsible? And what is the responsibility?

You may discover new classes as you do this. That's ok.

Coder: When you are done, take photos of the CRC cards.

Discussion