I think a core concept got lost with MVC - the controller "controls"
things. That is, it can directly update (control or talk to) a model and
a view.
A model should not directly update (control) anything except it's own
data sources (remote or otherwise), and should only broadcast changes to
anything listening, which should usually be just the controller, but
sometimes a view may listen for changes too (then you have to put
controller logic in the view, unless that particular view is a custom
fit for the model data).
A view similarly can be directly updated (controlled) by a controller,
view controller, or presenter (I like that - it's a descriptive term for
a view controller). For example, a controller for a list view changing
the data source to a different category, or deleting an item from a view
list because of remote changes, etc. A view should not directly control
(or talk to) a model or a controller - it should broadcast changes to
it's own state to whatever might be listening (and only controllers
should be listening). So if the user hits the delete button on an item
in a list view, the controller would receive a notification of some
kind, and then directly tell the model to delete that item. (The glue
between the controller and the view can be a bit messy in some APIs -
especially the iOS API, with targets and all that.)
To me having the model broadcast to the view is a shortcut - or even a
short circuit - one that is justifiable in many cases, but it's good to
understand that you are basically doing an end-run around the controller
usually to just save some short term development time, or because you
really do need a custom view for a particular model, rather than a
generic view.
That's how I understand MVC anyway.
Kevin N.
On 3/6/12 5:35 AM, Karl DeSaulniers wrote:
I guess I am looking to the controller to do the event dispatching to
the model
the model to listening for the result. the view listening for changes
to the model.
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders