the way i understand it, the controller is supposed to provide the logic and functionality for the views as well as acting as an intermediary between the view and the model (my version fires events back to the views but others use the controller to pass events back from the model to the view as well) and as such, the same controller can be used for multiple views (i have a single PageController for my basic site setup that provides the functionality for all of the pages as well as the logic about which page to show / hide)
there is plenty of commentary out there to suggest that the controller is largely unnecessary and that the views can do it all as encapsulated objects (i've even read something by someone much smarter than me [ http://c2.com/cgi-bin/wiki?MvcIsNotObjectOriented] that suggested that the c in mvc was anti-oop) but for me the benefit for the controller is that i can create functionality separate from design. if you look at the html / php / mysql model, mvc has a very natural flow - the mysql database and the php interact much like the controller (php) and the model (mysql) and the result is then fed to the views (the served html page). to be honest, for simlpe stuff, even within a large mvc project, i've found myself falling back to a model-view structure when the controller just made for extra complication and then kept the full-blown controllers for the really big stuff (my views take a mandatory model and an optional controller to allow for this). might have complicated it more with this for you but maybe i got something right best a On 29 March 2010 15:55, Karina Steffens <[email protected]> wrote: > Hi List, > > Ok, this may sound a bit odd coming from someone who's been coding with MVC > for the last 7 years, but I seem to be missing the point of a Controller... > I'm hoping to start a discussion to help me (and maybe others like me) > improve my architecture by better understanding the Controller, and what > good that does... > > First of all, here's a quick summary of my current architecture: All my > projects are based on an MVC structure in their core, but my Controller > class has only one function - linking the Model/s with the Views/s. The > communication between Model/s and View/s happens via Broadcaster - my own > AS3 reworking of the old AsBroadcaster (remember "broadcastMessage"? I > even > found a way to get and set public properties in the model using > broadcastMessage("get", "prop")). Typically, the model notifies the View > that data was loaded, and then the View does all the donkey work, and calls > a number of generic methods on the model, mostly for data retrieval. > > Within the View, I use EventDispatcher for the usual stuff, like button > functionality. The View classes are the ones that listen to the events. > For > example, a View class may have a submit button, and that button's > MouseEvent.CLICK goes to a clickListener method in the same class. If I > understand recent list discussions correctly, it would be better to move > EventDispatcher listeners to the Controller. Is that the correct approach? > If so, why...? > > When I coded my Controller class, I built into it the ability to link > Controller Classes with Broadcaster, as well as Views and Models, but so > far > I haven't seen a good way of implementing it, or even extending the base > Controller class, because everything in my code seems to be happening > either in the View or the Model layers. So where am I going wrong? > > Please understand that I don't mean to say that the Controller is no good > other than as a way to link the View with the Model, I'm just trying to > understand it better - there's always plenty of room for improvement! > > Thanks, > Karina > > > > _______________________________________________ > Flashcoders mailing list > [email protected] > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > _______________________________________________ Flashcoders mailing list [email protected] http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

