PureMVC Architects Lounge

PureMVC Manifold => MultiCore Version => Topic started by: eco_bach on December 30, 2010, 02:15:22



Title: Controllers as Mediators?
Post by: eco_bach on December 30, 2010, 02:15:22
Hi
Doing a lot of coding in Objective C lately, where mvc is really 'mvC', most of your application logic resides in viewControllers and this Controller functions primarily as a mediator between your model and view component.

I was wondering if and when it would make sense to apply the same logic to a PureMVC as3 project. ie instead of using a traditional PureMVC mediator, map a Controller command to a notification in your facade, and dump a lot of your view specific logic into this command.

Could anyone suggest or supply an example of architecting your application this way?


Title: Re: Controllers as Mediators?
Post by: puremvc on January 03, 2011, 09:19:38
It makes sense when there is a lot of logic involved. Creating or populating view components dynamically from multiple data sources where some computation is involved, for instance.

But for doing things like answering the view component's request for data by fetching it from the proxy and setting it on the component, the mediator is your best bet.

You don't want to spread the knowledge of the view components over many classes (i.e. having 5 Command classes that respond to simple requests from the component as opposed to 5 listeners in the mediator). Why? If you swap that component out, radically or change its exposed API, the refactoring impact is reduced to that single class if the mediator is acting as the single touchpoint in the app for the  component.

-=Cliff>