[Newbies] what's a model?

Herbert König herbertkoenig at gmx.net
Thu Dec 11 09:50:18 UTC 2008

Hello Aidan,

AG> Oh yes, I've read Squeak By Example and played around with Morphic a bit
AG> (although haven't created anything useful with it), I just need to figure out
AG> how to write a class that I can use as a "model" with Morphs such as
AG> PluggableListMorph.

any class that implements the necessary messages (e.g. #list) and
returns the expected values will do.

>> Squeak does include a class called Model, which is abstract and not much used these days.
>> Best not be distracted by it.

Together with MVC comes the dependency mechanism. This gives a model a
chance to tell all views they need to update without explicit
knowledge how many and if there are views.

This is implemented in Object and is a bit refined in Model.

Dependency is a bit non obvious and today events seem to be a
preferred replacement. But IIRC all the Pluggabble...Morphs stand as
Morphic replacements for the traditional MVC classes and thus use

Practical consequence: If a PluggableListMorph watches an instance of
YourModelClass this instance has to send itself #changed or #changed:
to notify the PluggableListMorph to update itself.



More information about the Beginners mailing list