CSE143 Notes for Monday, 3/29/10

Mostly I went over the syllabus (handout #1) which can be found on the class web page.

I started by pointing out that in the first two assignments we will be reviewing arrays and classes. It would be especially helpful to review chapters 7 (arrays) and 8 (classes) of the textbook as we work through this material.

I asked people why they thought that cassette tapes so quickly replaced reel-to-reel technology in the last 1960's. People had many answers. I argued that cassettes won because they took an inconvenient collection of stuff (tape, reels, etc) and turned it into an "it", a "thing", an "object". Several students gave this answer as well talking about cassettes as "more convenient", and "self contained." I said that this is a good analogy for understanding what Java classes get us. A Java class is a way of packaging a set of variables along with some code into a self-contained, encapsulated, convenient object.

I then spent a few minutes reviewing some basic terminology of object-oriented programming. I mentioned that the following is a good summary of the basic object idea:

An object encapsulates state and behavior.
The terms state and behavior are the technical terms we use, but they are the same ideas people had mentioned. For example, for a radio, the states would include on/off, volume setting, station setting, am/fm and so on. The behavior is that it plays music and that it allows us to change these settings. In programming, state usually means variables (data) and behavior usually means methods.

I then mentioned an idea that I got from Arthur Riel who has written a book on object-oriented design heuristics. Following Riel's advice, I asked everyone in the audience who knows how to use a radio to raise their hand. All the hands went up. Then I asked people to raise their hand if they know how to build a radio from low-level electronic parts. Fewer than 5% of the class raised their hand. This is an important distinction to understand. We all know how to use a radio, but only some of us know how to build one.

In programming, we refer to this as the "client" view and the "implementation" or "implementor" view. Another way of thinking of this is that the external/client view is the "what" part (knowing what the object does) and the internal/implementation view is the "how" part (knowing how the object does it). This is going to be an important concept to understand as we progress through cse143. One of the things that makes this more confusing in cse143 is that we will ask you to switch back and forth between these two views, implementing an object at the same time that you think about how it will be manipulated from the outside by a client.


Stuart Reges
Last modified: Tue Mar 30 13:50:27 PDT 2010