As part of the learning PureMVC I’ve created this example ([URL=“http://minim.pl/misc/pureMVCExample/SomePureMVCProject.rar”]sources). And I must say that I’m quite disappointment about PureMVC. But maybe I’m just don’t get the idea.
Here’s things that I don’t like:
- Getting references to proxies/mediators by global string.
var model:SomeProxy=facade.retrieveProxy(SomeProxy.NAME) as SomeProxy;
What’s the point in this? In that case why just don’t create bunch of references in static public variables in some main class (ApplicationFacade.someProxy)?
And after all, what if I want to have dynamic number of proxy/mediator class instances? Ones removed, another ones is created in running time.
- “The events (notifications) from nowhere, handled by anyone”
Let’s say I have at my app five models of clocks. And I have also five corresponding views of clocks. With every thick of every clock model, one of clocks views should be updated.
In normal approach there’s just created control class which create view and model instances, and make decisions if there’s any events from them.
In PureMVC looks like there’s only “global events” - ApplicationFacade.SOME_EVENT so if I want to do my 5 clocks I will have to:
- create notfication id: ApplicationFacade.CLOCK_TICK
- broadcast about it. But I will have to also pass the reference from what clock model it’s:
Now, from some command class that handle that event, should be made decision about updating certain clock view. The question is - from where that command class will know which clock view it is? And why this must be so complicated?
Updating all clocks with every tick event is not the answer.
BTW: comments from INotification.sendNotification
@param notificationName the name of the notification to send @param body the body of the notification (optional) @param type the type of the notification (optional)
“name” is name, “body” is body, “type” is type - o rly?
- Only “one level” model allowed?
I don’t know how to say this clear so maybe images will be better
In PureMVC conceptual diagram things looks like this:
But in real world things looks more like this:
Our SubSubModel should have some kind of proxy? Or only “first level” models “deserve” for proxy?
What if SubSubModel visual representation is so complicated that it should have dedicated view. How that view will get reference to that “deep-level” model? How they communicate?