I guess alot of us (including myself) have gotten used to the "global-thing-in-disguise" from using it that way in Flash and kept doing so in Flex.

Personally I don't have a problem with it and I use my own MVC-type 
architecture that also includes a Singleton Model.

The thing that bothers me about Cairngorm is the name "ModelLocator" as outlined in the article. ModelLocator doesn't "locate" models, it IS the model.
ARP has a ModelLocator that does "locate" models and my guess is that's where 
they borrowed the name and it kinda stuck around.
If memory servers me right, to get to the Model you want in ARP you'd use 
something like:

var cart:ShoppingCart = ModelLocator.getInstance().getModel("shoppingCart");
cart.total = 458.5;

Cairngorm also doesn't have an "events" package, but rather stores their main Event class 
in "control"
com.adobe.cairngorm.control.CairngormEvent
com.adobe.cairngorm.control.CairngormEventDispatcher

I'd prefer:
com.adobe.cairngorm.events.CairngormEvent
com.adobe.cairngorm.events.CairngormEventDispatcher

which is more inline with the Flex framework

And one more thing I dislike is the 1 on 1 mapping of Events and Commands.
From what I've seen in their docs and samples they use a different Event class 
for every Command, which IMO makes no sense.

GetUserEvent
UpdateUserEvent
DeleteUserEvent
CreateUserEvent

And the static constants are stored someplace else, can't remember but think it 
was the Controller (that extends FrontController).

Rather than having 4 Event classes for each Command I prefer 1 Event class:

UserEvent

which has as many static constants as required:

public static const GET_USER:String = "getUser";
public static const UPATE_USER:String = "updateUser";
public static const DELETE_USER:String = "deleteUser";
public static const CREATE_USER:String = "createUser";

Again this is inline with what is already present in the Flex framework:

MouseEvent.CLICK
MouseEvent.MOUSE_DOWN
MouseEvent.MOUSE_UP

etc..

Think that's about it..

regards,
Muzak

----- Original Message ----- From: "Merrill, Jason" <[EMAIL PROTECTED]>
To: "Flash Coders List" <[email protected]>
Sent: Tuesday, November 18, 2008 4:11 PM
Subject: RE: [Flashcoders] frameworks and flash


Read the article, some good, some bad.

What are your thoughts on the article's baching of Cairngorm's ModelLocator? The he says its really a global var in disguise, and I understand that, but I still find it very handy - maybe it makes it somewhat tighter coupled to the model, but I use the same implementation of it in non-Cairgorm projects just because it's so handy. I can see where it wouldn't be good in a coding environment where you have to loosely couple everything, but it also seems to have its uses. Any thoughts on that?


Jason Merrill
Bank of America     Instructional Technology & Media   ยท   GCIB & Staff Support 
L&LD


_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to