Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought

Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Author Topic: Controllers as Mediators?  (Read 5677 times)
Courseware Beta
Sr. Member
Posts: 81

View Profile Email
« on: December 30, 2010, 02:15:22 »

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?
Global Moderator
Hero Member
Posts: 2871

View Profile WWW Email
« Reply #1 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.

Pages: [1]