This link has been bookmarked by 1 people . It was first bookmarked on 28 Aug 2008, by Mairon Croes.
-
28 Aug 08
Mairon CroesForum thread about view component and mediator coupling and the best way to do this (loose vs tight)
puremvc forumposts guide bestpractices development flex tipsntricks
-
In many of the demos I've seen the mediators are directly referencing components [TextInputs for example] within the view.
Would it be better decoupling to have the view pass the corresponding VO *with* the Event as opposed to having the mediator catch the event, and then "dig into" the view component to "pull out" the desired data (i.e. construct a VO from components w/in the view component)? -
The most loosely coupled way is, as you say, to exchange that data using a custom object or VO, passed to the mediator via a custom event.
-
But it is best to encapsulate as much of the component’s implementation as possible. Having the component exchange data with a custom typed Object is better.
-
If you create a view component that is simple, and it only has one or two properties that the mediator needs access to, then creating a custom event AND a VO is overkill.
-
Cliff, would you recommend having the mediator set the currentState property, or having named constants for states and a public function that accepts such a const and uses a switch statement to set the view?
-
I think the Mediator should set the currentState property of the view component to a named constant defined in the view component class.
-
Would you like to comment?
Join Diigo for a free account, or sign in if you are already a member.