[comp.lang.c++] using the Smalltalk model WAS Advice on design

rae@gpu.utcs.toronto.edu (Reid Ellis) (09/05/90)

Either sarima@tdatirv.UUCP (Stanley Friesen) or mjv@objects.mv.com
(Michael J. Vilot) wrote:
|The book 'with examples in C++' is *far* too caught up in a
|Smalltalk style of OOD to be really useful for good C++
|programming.

In <1197@fang.dsto.oz> dch@aeg.dsto.oz.au (Dave Hanslip) writes:
|I assume this refers to "Object-Oriented Program Design with
|Examples in C++" by Mark Mullin. I've seen this opinion expressed
|before. Perhaps you could explain why.

Right from the start, I should state I am not an expert on
SmallTalk style OOD.  I'll try to express what I perceive as the
difference between SmallTalk and non-SmallTalk OOD.

In a very general sense, there seem to be two methodologies when
writing object-oriented software: the SmallTalk model and the
not-SmallTalk model [NSM].  There may be a better name for the
latter :-).  The dividing line between this model and
not-this-model is the existance of a unique base class, commonly
called 'Object' or 'TObject' or something similar.

Both NIHCL and MacApp follow the SmallTalk model, and I think
Objective C does as well.

The alternative with NSM is to have a number of non-unique base
classes.

The tradeoffs involve the overhead of creating a new [small]
object which conceptually has no ancestors and the ability to use
this object.  In the SmallTalk model you can send this object any
of a number of common messages, whereas this is not possible with
the NSM model.  However, the NSM object is small and carries no
overhead.  You could pass it on the stack if you like and feel
comfortable with knowing roughly how efficient it is to do so.
Not neccessarily so with the SmallTalk model.

There are some caveats here, however.  If the base Object only
consists of methods/messages with no data, it is conceivable that
its representation on the stack would be very small [type
information] since methods may not really be instantiated for every
object.

Hope this ramble helps.  Feel free to correct the above.

					Reid
--
Reid Ellis  264 Broadway Avenue, Toronto ON, M4P 1V9               Canada
rae@gpu.utcs.toronto.edu || rae%alias@csri.toronto.edu || +1 416 487 1383