Ria framework-cairngorm 2 profiling

Source: Internet
Author: User
Tags call back

Author itereation: Two was transferred to Adobe to form a consulting team and flex 2/as3 market. The consistency and popularity of the framework of cairngorm are also high with those of the watermarked boat, recently, the new version cairngorm V2 tailored for flex 2 was released, so it took some time in the morning to review it again to see if there were any major changes, this article is a quick record of previous research experiences.

Simply put, cairngorm is a framework that provides many existing class libraries, runtime systems, and templates, the goal is to assist the project in developing medium-and large-scale disaster recovery scenarios (by saying mid to large I mean 5-10 engineers in several teams and project time ranges from months to years ).

Its architecture is very simple, with only six

-Business
-Commands
-Control
-Model
-View
-Vo

Cairngorm defines the base structure of the six major architectures, and then adds the required functions after each project is extends. This is also the method of most frameworks, for example, ARP, struts, and cake.

In the example of login included in cairngorm 2, the event process is as follows:

1. there are two text boxes on the upper and lower sides and one login press box. When the user presses the button, form will package the content of two character spaces into a loginvo (Value Object), and then broadcast the event again.

2. The frontcontroller of the background engineer will first listen to this event through addcommand () and hand it over to the command handler.

3. command objects only perform two tasks. One is to create a delegate object, which is passed back to the server (please refer to the next step), and the other is to create a responder object, there are onresult and onfault callback handler on the Response Surface.

4. in terms of delegate, the real information is stored with the server. (The fancy is that it will reply to the middle tier for data exchange and synchronization ), you can decide to use remoting, Web Service, http get/post, and other methods to compile the response on this object, as long as you confirm when the response is returned, call back handler of responder response to be correct mapping

5. when the repsonder receives the result, it will handle it later. In the design of cairngorm, there is a central storage called modellocator, which is basically a singleton class, there are a bunch of changes and objects to be shared during the program running period. In the past, everyone was stuck in the _ global environment, later, in As2, I called it globalsettings (or someone called it systeminfo). The meaning is the same. In this example, responder updates the received result to the modellocator response plane.

6. The most special feature is that after modellocator is updated, each member on its memory is set as binding, so the information changes, it will trigger all the objects that bind to it, such as the view partition or the update of dataprovide.

At this point, an event process is finished.

There are several interesting points in this area:

-Each tier is very dry-cut, or even too dry-cut (you have heard the water clear, right ?), The division of labor is clear and simple, so it can be said to be very decoupling. This is very important for large cases.

-The command and delegate commands are based on the principle that, if you want to jump from the Web service to the remoting or even more elegant flex enterprise service, as long as the delegate token is removed, the responder part can be reserved.

-He makes good use of the features of flex 2 release event bubbling, so that all events can be bubble to the most recent application and then focus on handling, it's just a little tricky to do this. You must use the self-generated event class to broadcast the program.

Summary:

1. cairngorm is a framework designed to be non-ready, but the actual server usage is not high, the main reason is that his fault point is his fault point. For example, the opening time may be extended due to the too-dry cut. for small and medium sized cases (two to three persons under 50 million yuan), the cut point may become too long.

2. Some of his designs are very similar to decoupling, but in practice, they will encounter a problem to avoid it. For example, the design of command should be re-usable, however, in fact, the difference between each case may lead to a very low rate. Another example is the separation between command and delegate, in practice, when switching from web service to remoting, if the structure of the retrieved data is different from that of the type, the callback must re-submit the callback handler, therefore, At first there was a problem with such a distributed design.

3. Simple execution. When thinking of every task (for example, login), six transaction cases (controller, command, delegate…) are required ...) I feel a little powerless. Even a self-abused Java engineering engineer may not want to ease debugging, let alone if it is in debug, I am afraid it will take six times to trace to the correct case.

As the cloud in ancient times: know the rules so you know what you are breaking.

I know that cairngorm is still quite difficult. At least I know where it can be used and where it can be improved, what's more, if there is a naive attempt to handle a super-large legal case, at least know how to use it (the dead friends do not die ?).

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.