From: johnson@m.cs.uiuc.edu (Ralph Johnson)
Subject: Re: SHlaer-Mellor OOA Model, Problem with definition of Object
Organization: University of Illinois, Dept. of Comp. Sci., Urbana, IL
Date: Mon, 27 Jul 1992 05:50:45 GMT

sally@projtech.com (Sally Shlaer) writes:

>>> Now let us switch over into OOD land.  As I see it,
>>> the word "class" today combines two ideas:
>>>  +    the typical unspecified instance (I don't care which instance
>>> you are thinking about, this operation works the same way on any 
>instance).
>>>  +    the collection of all existing instances (as in class data, 
>iterators
>>> and similar class methods)

>> {from Ralph]  I only use "class" for the first concept.

>OK.  Then I think this is what we are saying:  A typical unspecified 
>instance is a class to Ralph (who I am taking to be a spokesman for 
>OOD), and an object in S-M OOA.  OOA does not have a word for the 
>collection of existing instances.

After thinking things over, I decided that class doesn't mean
"typical unspecified instance" to me.  Class means "the set of
all possible instances that have existed, exist, or might exist in the
future".  For example, "Number" doesn't just mean all the numbers that
I have written down, it means all the ones I could ever write down, and
even the ones that I might theoretically write down if I could live forever.
Class means "category", "type", or "group".  A class description describes 
the category or group. 

Object means instance to me.  I don't use the word "instance" much.
I might say that "x is an instance of class Y", but I would be more
likely to say "x is a Y", because it is shorter and more natural, though
a little less precise.  Thus, I would say "topView is a StandardSystemView".
Note that topView is a *variable* that refers to some unknown instance of
StandardSystemView, so this is not referring to a particular object, but
to whatever object becomes referred to by topView.  I guess that means
that when I want to refer to an unspecified instance, I use a variable.

>Questions:  1.  Do you have a word for the collection of existing 
>instances?

No.  I might say that I keep a database of current employees, or
something like that.  I find that most of the time I never need to
know about all the existing instances.  Even if I have employee objects,
I am only interested in the employees of one company.  It is better to
model the collections explicitely, and not depend on any built-in notion
of the collection of existing instances.  Of course, there are exceptions,
but they don't happen enough to cause me to invent special terms.

>2.  What do you mean when you say "object"?  Can you answer in terms of  
>"how many" and specified vs. unspecified -- or is there another 
>dimension that we need to take into account? 

Object means one.  If I say "an employee" then I am referring to some
unspecified employee, which might be in class Employee or in a subclass
of Employee.

>3.  When you said "Like you, I consider a collection of instances to be 
>an object", you were using the OOA definition of object -- right?

Nope.  I was just saying that collections can be objects, too.  Smalltalk
even has a class Collection to represent collections.

>4.  When you said "Moreover, I don't consider a class to be an object 
>during high level design", were you using the same or a different 
>definition?  (This one has me somewhat more puzzled.)

In Smalltalk, a class is an object.  In C++, it isn't.  Some people
think that there is magic in making a class an object.  Perhaps there
is from a programming language implementor's point of view, but not from
an application programmer's.  Application programmers make use of the
fact that a class is an object to parameterize objects that create other
objects with the classes of the objects that they create, and to define
specialized instance creation operations, and that is about all.

It is possible to do funkier things than that, like adding code to
classes on the fly, or creating new classes on the fly, but this is
not common, and is certainly not normal programming.  It is metaprogramming.

By the way, the history was interesting.

Ralph Johnson -- University of Illinois at Urbana-Champaign
Newsgroups: comp.object,comp.lang.eiffel