Newsgroups: comp.object,comp.lang.c++,comp.lang.clos
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!howland.reston.ans.net!newsserver.jvnc.net!adl33cc!sbloch
From: sbloch@adl15.adelphi.edu (Stephen Bloch)
Subject: Pedagogical examples wanted
Message-ID: <D3JC45.D76@adl33cc.adelphi.edu>
Sender: news@adl33cc.adelphi.edu (USENET News System)
Nntp-Posting-Host: adl15.adelphi.edu
Organization: Adelphi University, Garden City, NY
Date: Sun, 5 Feb 1995 16:21:40 GMT
Lines: 54
Xref: glinda.oz.cs.cmu.edu comp.object:26163 comp.lang.c++:111050 comp.lang.clos:2776

About two weeks ago I posted a request for examples people have found
pedagogically useful in introducing various aspects of OOP, particularly
examples in CLOS and C++.  I'm looking for examples ranging from things
you can go over in an hour's lecture to things you can assign as a
month's programming project.

The response so far:
FOUR (4) people saying "Yes, I need that too; let me know what you find."
ONE (1) person recommending his book (which may, indeed, contain good
examples; I haven't yet had time to chase it down).
ONE (1) person recommending a particular graphics toolbox (as an
illustration of how people put together such things in an OO way)

Since two thirds of my sample consisted of people asking the same
question, rather than people with answers, I think there is interest in
the subject.  So I'll ask again, and suggest that this might eventually
go into FAQ.

To get things started, I've used the usual classroom examples like
(a) a class "food" with subclasses for "pizza", "ice cream", "rice",
which in turn has subclasses for "brown rice" and "white rice" that
differ mainly in how long they cook
(b) classes "conveyance" and "machine" with subclasses "horse" and
"computer respectively, and joint subclass "automobile"
(c) class "vehicle" with subclasses "automobile", "bicycle", and
"canoe"; upon writing the implementations for changing the tires on an
automobile and a bicycle, you decide to insert a "wheeled vehicle"
class in between.
(d) classes "person" and "food" with subclasses "adult" and "child",
resp. "cookie" and "ice cream cone", and four different multimethods for
"eat" applied to the cross product {adults, children} x {cookies, ice
cream cones} (this example taken from Keene's book).

As a more substantial example, I'm using a program I originally intended
for my Operating Systems students (a discrete-event simulator of a
multiprogramming OS).  "Process" and "Event" are obvious object classes,
each with subclasses.  There may also be a (normally unique) "ProcessTable"
object, and when/if we get to virtual memory, classes for "Page", "Page
frame", etc.

I also hope (on the suggestion of someone on this newsgroup; I forget
who) to have the kids implement the beginnings of a Scheme interpreter
later on in the semester.

Unfortunately, I can't testify to the pedagogical usefulness of any of
these, because I haven't taught the course before (and am something of a
novice at OO anyway).  Additional suggestions, or comments on these
examples, will be VERY welcome!

--
                                                 Stephen Bloch
                                           sbloch@boethius.adelphi.edu
                                          (or sbloch@adl15.adelphi.edu)
                                        Math/CS Dept, Adelphi University
