On 05/03/2012 16:44, Kevin Newman wrote:
If the model is updating the view,
Not my model. My views listen for model change events.
then it doesn't sound like you have a generic view at all. This can be
appropriate in certain cases, but if you really want reusable View
objects (like a generic scrolling text or image list view), they
should be generic and abstracted from the underlying data sources (the
model) - and have the data filtered through a data adapter, usually
associated with the controller (or you can skip the adapter, and just
bulk convert the entire model list data into generic view data, if
it'll fit in memory or won't be updated in real time).
I think that you're referring to the OTT pattern, favoured by many.
I try and keep things simple.
In this version of MVC, to answer the original question - the
controller sets up the view and wires the data source, but doesn't
necessarily directly update the view (though that's who's job it is).
In iOS these kinds of controllers are actually called "view
controllers" - for maybe obvious reasons. :-)
Kevin N.
On 3/5/12 7:31 AM, Paul Andrews wrote:
I don't think the controller should be updating the view. Period. Nor
do I think that the view should be calling methods of the controller
class.
One of the main benefits of MVC is separation of concerns. Views
shouldn't care about controllers, controllers should care about views.
My views dispatch events about their changes and the controller
listens for the events, not caring which view dispatched it.
The controller updates the model, and the view listens for changes in
the model.
There are several ways to build the MVC pattern. The video shows one
way, but really it shows a coupling that shouldn't be as tight as it
is and the idea of a controller updating a view, is a no-no.
Sometimes people use a micro-mvc architecture within a view to
control it - no problem about that, but we should keep our MVC
components as separate black boxes.
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders