PureMVC Architects Lounge

Announcements and General Discussion => General Discussion => Topic started by: masterkrang on November 30, 2010, 12:34:01

Title: Mediators directly communicate with Proxies?
Post by: masterkrang on November 30, 2010, 12:34:01
I'm am totally new to PureMVC. Thanks for having me here. So far I noticed PureMVC solving a lot of questions I had when starting to develop larger flash projects, most notable managing multiple view / component events, how to keep track of them and how to make sure others knew about them.... can be a nightmare.

I've been using the project example CafeTownsend (found on this site) as a guide while writing my own sample app (a Flash Builder app that connects to twitter api). One thing that stood out to me after trying to write this sample application was the role that the Controller or Commands play. They seem to have a really passive role from what I see in other MVC frameworks like Ruby. I'm not totally versed in MVC frameworks, and I'm sure there is an explanation, but I couldn't figure it out. I was surprised that the Mediators were connecting directly to the Proxies when they needed data, not involving the controller very much during that process. Is that a normal thing in MVC?

In my application now, I can use my Flex components (Views) along with Mediators just fine to get the data I need from the Proxies. The event model makes sense and it's pretty clear how things are less coupled than other approaches and more reusable. I'm just having a little bit of trouble figuring out what role the Commands play in this process. As of now, based on the Cafe Townsend project, the Commands simply instantiate the views on startup. I don't know why but it seems a little bit odd for me to think of a Command as a Controller. If anybody wouldn't mind shedding some light on the roles that Commands play, share insightful tutorials that would be great.


Title: Re: Mediators directly communicate with Proxies?
Post by: Tekool on November 30, 2010, 02:38:12
In MVC definition it is said that the view can have full knowledge of Model. But the Model must not know directly the view. This said, Model can send update signals via an Observer pattern to any view listening for a specific update as it does not know its concrete classes.

In PureMVC for AS3 what you probably saw where view consuming VO coming from the model with an automatic update mechanism involved by the Flex Framework. This uses Observer pattern, the model doesn't know the view so it is always "pure MVC". ;)

Title: Re: Mediators directly communicate with Proxies?
Post by: masterkrang on November 30, 2010, 10:30:37
Thanks for the reply Tek.