[self-interest] Model View Controller and the Observer pattern
Jecel Assumpcao Jr
jecel at merlintec.com
Sun Aug 26 22:53:16 UTC 2001
Albertina,
> Now I have a very specific question and for me it is very important
> it is answered in a scientifc way!!!
I think you ended up forgetting your question, for I didn't find it in
the rest of the text. So I will suppose that you are interested in
known if Self has an implementation of the Observer Pattern similar to
Smalltalk-80.
The answer is: no. Morphic handles this in a less flexible way than
MVC. Each object sends "changed" to itself whenever its internal state
is changed and the same object should do something about it. The idea
in Morphic is that each object should appear only once on the screen
and so we don't need multiple viewers.
An exception to this is outliners, which when representing a morph can
be on the screen at the same time as the morph itself. The morph "view"
is updated by the "changed" code, but the outliner isn't. Instead, the
outliner uses the periodic "step" method to poll the object and see if
anything has changed. This is not efficient, but gets the job done.
This is why an outliner sometimes takes several seconds to reflect
changes to an object you have sent a message to.
Please note that the original creators of MVC are now using Morphic
exclusively.
> As fundamental as the Observer appears to be in Smalltalk it is
> not a language feature (language feature and construct is the same
> thing?); it is a feature of most Smalltalk libraries.
Yes: language feature and language construct is the same thing. No:
Observer is not a fundamental Smalltalk pattern. It is key to MVC, but
you can have Smalltalks with other graphical systems and not need it at
all. So it is a good thing that the ANSI standard ignores it.
-- Jecel
More information about the Self-interest
mailing list