My experience on Cairngorm Framework

Cairngorm is similar as MVC. It focuses more on the separation of different layers in an application, but ignores the codes complexity and the redundancies of codes. In addition, you have to rely on the Cairngorm library in order to use the Cairngorm Framework, in which case, you have to choose AS and MXML as the programming language. There are three parts in Cairngorm Mechanism, the model layer, view layer and the command layer.

 

In the model layer, there is one or more Model Locators, which relies on the scope of your application. If you have to hold too many data objects, you may not only use only one Model locator. I think this is really a good idea to keep data materials.

 

In the view layers, there will be many operations, such as clicking a button or changing some properties. All of these may dispatch relative events, which may be mapped to some particular commands. Front Controller is just doing the mapping job. In my point of view, however, you may directly define the codes in the View layers files, or if you want to separate the operations from the view layer, you may create some AS files dealing with operations. For instance, you may create a SearchAM file to handle the searching operations. There is no need to use the binding between events and commands. So I think the main redundancies will appear here. In the meanwhile, if there are too many operations we need to handle, the complexity of the Front controller will be the problem. It seems not easy to define the commands and events.

 

As to the delegate and Service locator, I don’t think there is any problem here. When compiling, the MXML files will be transferred into AS files at first, and then both of them will be compiled into SWF file, a binary file. So I prefer to use both AS and MXML to implement the operations, not only depends on the Cairngorm Framework. As is known that AS is more suitable for implementation of business logics and models, while the MXML files are suitable for page layout.

However, the idea of the singleton Model Locater is really good!

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章