A nice pattern

Ralph Johnson johnson at cs.uiuc.edu
Mon Aug 21 12:26:13 UTC 2006


A BOM is not Type Object.   The point of Type Object is that the
"type" describes a general category or "type" to which the instance
belongs.  A BOM describes a part-whole relationship.  An instance is
not a part of the type.  A BOM is like Type Object in that there is a
1-N relationship, but otherwise they are different.  If the Type
Object pattern makes it possible to make that misunderstanding then it
is poorly written.

The Aggregator pattern should be called "Collection", and it is very
important to teach it to new programmers.  It is not worth putting in
a more advanced book of patterns because everybody knows it already.
On the other hand, a lot of programmers don't know Type Object.
Smalltalk programmers usually do know it, though, because we think of
classes as objects and so it is easy to imagine that we have a
class-like object that is not a class, but is just a regular object.
When I use Type Object in Smalltalk, I like to give the type a #new
method to create an instance of that type.  This helps convince people
that it is a little like a class.  But even among Smalltalkers, it is
useful to have a name for the pattern.  I've helped several projects
by naming the pattern that they were already using and thereby helping
the architect (who already understood the pattern deeply and
intuitively) communicate with his team.

-Ralph Johnson



More information about the Squeak-dev mailing list