What is cairngorm? How do we use it? or Explain the lifecycle of a Cairngorm action?

Some of the frameworks in Flex are : EasyMVC, Cairngorm, Mate, Swiz. I had worked only on cairngorm and so putting down its details:
Overview of Cairngorm
What is Cairngorm? Cairngorm is fundamentally a methodology for breaking up our application code by logical functions; by data, by user views, and by the code that controls everything. This is routinely referred to as MVC, or Model, View, and Control.
The Pieces of Cairngorm
•Model Locator: Stores all of our application’s Value Objects (data) and shared variables, in one place. Similar to an HTTP Session object, except that its stored client side in the Flex interface instead of server side within a middle tier application server.
• View: One or more Flex components (button, panel, combo box, Tile, etc) bundled together as a named unit, bound to data in the Model Locator, andgenerating custom Cairngorm Events based on user interaction (clicks, rollovers, dragndrop.)
• Front Controller: Receives Cairngorm Events and maps them to Cairngorm Commands.
• Command: Handles business logic, calls Cairngorm Delegates and/or other Commands, and updates the Value Objects and variables stored in the ModelLocator
• Delegate: Created by a Command, they instantiate remote procedure calls(HTTP, Web Services, etc) and hand the results back to that Command.
• Service: Defines the remote procedure calls (HTTP, Web Services, etc) to connect to remote data stores.
How the Pieces Fit Together
Cairngorm basically works like this: Our client interface is comprised of Views. The Views use Flex binding to display data contained in the Model Locator. The Views generate Events based on user gestures such as mouse click, button press, and drag & drop. Those Events are “broadcast” and “heard” by the Front Controller, which is a map of Events to Commands. Commands contain business logic, create Delegates to perform work, handle responses from Delegates, and update the data stored in the ModelLocator. Since Views are bound to the data in the ModelLocator the Views automatically update when the ModelLocator data is changed. Delegates call Services and hand results back to Commands, and are optional but recommended. Services make remote data calls and hand the results back to Delegates.

No comments:

Post a Comment