简体   繁体   中英

Cairngorm Model Locator Pattern

In Cairngorm (Flex Framework), there is Model Locator Pattern, which is similar to Global variables, is it a right pattern, Adobe is saying for flex its best pattern

Adobe Consulting team conceived the Model Locator pattern as a best practice for Flex developers to adopt. The Model Locator pattern is unique because it is not a pattern we borrowed from the Core J2EE Pattern catalog. Instead, we created this pattern particularly for Flex application development. Our motivation was to have a single place where the application state is held in a Flex application and where view components are able to “locate” the client-side model that they wish to render. Our Model Locator pattern strategy encourages the use of data binding so that view components bind directly to the client-side state held in the single instance of the ModelLocator class. In this way, whenever the model is updated in ModelLocator, all view components binding to the model receive notifications (through the underlying data-binding mechanism) and update themselves to render the new model on the client.

From what I am reading, I suspect that you are talking about Cairngorm 2 and its advised best practices. You should know that the Cairngorm framework has changed drastically since version 2.

There now is a newer version, Cairngorm 3 which is more like a set of guidelines, tools and libraries which you can incorporate in a project that is created with any other Flex application framework.

I would advise you to look into some of the new(er) frameworks like RobotLegs , Parsley or Spring ActionScript

Cheers

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM