A nice pattern

stéphane ducasse ducasse at iam.unibe.ch
Mon Aug 21 12:50:16 UTC 2006


On 21 août 06, at 14:26, Ralph Johnson wrote:

> 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.

Yes

Before knowing TypeObject I was developing an application to manage  
my cactus collection
and there you want to make the distinction between the plant that you  
hold in your hand
and that got a insect attack and made 3 times flowers from the  
general gender, family... location...
book ref. You want to have your concrete object and a "type"  
descriptor object that you can share
between all the plants of the same kind. And I read TypeObject and I  
said ok this is it.
I implemented without knowing it so this is the proof to me that this  
is a really cool pattern.

> 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.

Yes.
One pattern that always worried me is chain of responsibility since
we cannot really use the name for classes.
I was discussing that with avi since in seaside the decorator are in  
fact
chain of responsibility.

:)

>
> -Ralph Johnson
>




More information about the Squeak-dev mailing list