[self-interest] patterns and Self

Thomas Kuehne kuehne at informatik.uni-kl.de
Thu Dec 14 08:39:53 UTC 2000


Jecel Assumpcao Jr wrote:

> As promissed, here are some quick comments from a Self programmer's
> viewpoint on the patterns in the "Design Patterns" book by Erich Gamma,
> Richard Helm, Ralph Johnson and John Vlissides.

Thanks, Jecel for this fine list.

I just have a few minor comments:

> ===> Iterator(257):
>
> [...]
> Iterators are important in languages like Self and Smalltalk that have
> a very awkward syntax for accessing vector elements.

I would not argue that Self and Smalltalk *need* the internal version of the Iterator pattern because of their awkward syntax for accessing vector elements.
Rather, the Smalltalk languages/library (can not speak for Self really because I do not know its approach) got it right in terms of releasing the iteration clients from the burden of providing a control structure (i.e., loop) each time they want to enumerate the elements in a structure.
In other words, even languages with a fantastic syntax for accessing vector elements should not be doing the external iteration style. AFAICS, there is no good reason to do external iteration (see my paper "Internal Iteration Externalized" if in doubt :).

> ===> Mediator(273):
>
> Hmmm... I am not sure, but the damage/redraw logic distributed between
> morphs and the worldMorph might be considered an example of this. I
> don't see that Self is particularly helpful in this case.

Probably the Mediator pattern realization as described does not benefit from Self's capabilities, but maybe an enhanced version would, where Mediator methods could work in the context of the objects the Mediator is controlling. That way mediating code could be completely concentrated in the Mediator and controlled objects would never need to know about mediators.

> ===> Observer(293):
>

Same argument here. Maybe an implementation that better separates concerns could be realized with Self's delegation features. Getting the right piece of information after a change from the Subject to the Observer maybe is easier with delegation?

Regards,

    Thomas

--
Dr. Thomas Kuehne
0178 4314387, http://www-agce.informatik.uni-kl.de/~kuehne
The difficulty in doing research is to find the right questions
so that all the answers come easily. -- TK







More information about the Self-interest mailing list