November 19, 2003

Bulk view

CookOrDie: Day 7: Reheated rice, sausage slices

Leftover rice plus Hungarian sausages. Okay, but not as fun as bread
or potatoes. Tomorrow, will check out meat shop.

Yang chow rice from Red Panda reheated very nicely – still moist.
Extra rice left over from The Barn (eeew, two days!) was too dry.
Should try to reheat it in separate container with more water.

Hungarian cocktail sausage slices not best for mixing with rice.
Perhaps whole sausages or somewhat larger slices so that it can be


CS21A: Smiley

I drew a smiley on the board and provided the skeleton for a new class
that drew only the circle that represented the face. I asked the
students to get it to display a smiley according to the drawing. While
they did that, I downloaded my source code for and
the modified classes from the BlueJ sample
project (added move() to Triangle and Circle) and showed them my
implementation. I wanted them to define a class that supported many of
the operations the basic shapes did. I started with a single Circle
attribute representing the face, a constructor that created the
circle, and a makeVisible() method that made the face visible.

The major conceptual point I wanted to make was:

You can define your own class that contains objects. You can call
methods on those objects and you don’t have to worry about the
implementation details. You can support the other methods by passing
the method calls to the different objects.

A number of students started by looking at and trying to
model their work on it, but I suggested working from the very simple
skeleton we had on the board. This greatly helped the students who
were getting lost in the source code.

I also pointed out that they could use BlueJ to determine the
coordinates and sizes experimentally. Instead of edit-compile-test,
they could interactively create an object, manipulate it, and then
inspect it to find the necessary values.

This exercise was open-ended. After students got the smiley to
display, they added support for moveUp(), moveDown(), moveLeft(), and
moveRight(). moveHorizontal(int distance) and moveVertical(int
distance) followed shortly after. move(int x, int y) required a bit
more thought because they couldn’t just pass the request on. I also
had a simple animate() method. I suggested making it possible for the
user to change the smiley’s colors (face, eyes, and mouth – separate
methods, or one method with three parameters) or size (bit more

I think this exercise worked very well. I did not have to tell the
students exactly what to do, although I gave them a number of hints. I
exposed my planning process – first, get the face to display, then add
the eyes, then the mouth, then add other methods one at a time.
Students learned how to plan implementation in small steps. I did not
tell them what they had to do; I just drew a figure on the board and
had a demo up on the projector. On their own, they figured out that
they needed to specify negative height in order to get an inverted
triangle and add offsets during the move.


Having breezed through the first slide set in one class day while the
other teachers are just halfway through, I wanted to help my students
review the topics. I prepared a reviewer for the first slide set of
operating systems (SXI
PPT) and asked students to
answer as an ungraded exercise. It revealed a lot of areas for review,
and I’m glad I did it.