[newbie]Does Model + Morphic = MVC?

Andre Maloney amaloney at earthlink.net
Fri Feb 22 03:52:11 UTC 2002


On Wednesday 20 February 2002 10:23 am, Lex Spoon wrote:
> Andre Maloney <amaloney at earthlink.net> wrote:
> > I'm trying to figure out where Model and its sublasses fits into the
> > Morphic world before I delve too deeply into any of the writings that
> > explain MVC.
> >
> > At first glance it appears that Morphs encapsulate view and controller.
> >
> > Is that too simplistic, and if so, what else do I need to be aware of? Is
> > this on the swiki anyplace (or anyplace else)?
>
> No, I think that's an excellent way to look at it.  Note that sometimes
> Morphs also incorporate the model, too.
>
> Alternatively, you could think of there not being controllers any more,
> and there being a single system-wide controller that sends events to all
> morphs in a standard way.
>
>
> By the way, be sure to keep seperate the MVC approach to designing
> programs that have graphics, and the MVC framework that is implemented
> in Squeak.  Thus you can say things like: "you can use the MVC approach
> in both MVC and Morphic."  :)
>
> > Also, are there any general rules for when to sub-class Model?
>
> Well, in Smalltalk, you can make a model without subclassing from Model.
>  In fact, I never subclass from Model to begin with, and only change the
> superclass from Object to Model if it comes to make sense.  If it never
> seems obvious to do this, then don't worry about it, IMHO.
>
Lex, 
Thanks for pointing out the usage of model (the concept)  vs. Model (the 
class) I'll be sure to keep that in mind as I'm reading. 

I found a reference to Model in "Smalltalk by Example" in the chapter
on the dependency mechanism. Mr. Sharp finishes his discussion with: "If you
don't fully understand this, it doesn't matter. Just remember the basic rule: 
If you are going to use dependencies a lot, subclass your parent class off 
Model rather than off Object." (pg. 154)

Looking in the image, I see that the browsers are subclassed off Model 
which makes sense in light of his rule.

I don't fully understand it, but it appears that using the dependency 
mechanism in Model is more efficient than the one in Object.
(I'll let that simmer for a while.)

Cheers.



More information about the Squeak-dev mailing list