Re: MVC Theory Help
Re: MVC Theory Help
- Subject: Re: MVC Theory Help
- From: Greg Guerin <email@hidden>
- Date: Wed, 10 Jun 2009 13:14:09 -0700
Chunk 1978 wrote:
so i get View and understand Controller, but i'm a touch fuzzy on
Model.
does anyone have a simple way of explaining this? perhaps a clever
anecdote?
Look at a Finder window.
The file-system is the Model for Finder windows. The view depends on
what the user has chosen: Icons, List, Columns, or Cover Flow. The
choice of view does not affect the model, but things that exist or
change in the model drive what appears in the view.
If something changes in the model, say some program creates or
deletes a file, then the view changes, even though the creation or
deletion of the file only changed the model, i.e. the file-system.
Observers of the model will see the change, and make the requisite
changes to the view, but exactly what those view changes are depend
entirely on what kind of view it is.
Another example is CPU temperature.
The physical temperature sensor (and its device driver, etc.)
comprise the model. Any number of views can monitor and express
temperature: a digital display (Centigrade or Fahrenheit), a vertical
bar, a horizontal bar, or even something that changes the display's
color calibration so that hotter temps make the display redder.
Not every view has to be visual, however. For example, the
temperature monitor (a Controller) can drive a speech synthesizer
"view" that changes speech modulation to sound more frantic as
temperature rises. It can even send Tweets or do other things that
have no visual element.
Furthermore, there can be hardware-based "views", like fan-speed,
where the Controller monitors changes in the model and drives some
hardware, namely a fan-driver chip.
-- GG
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden