About Frameworks and Design patterns
In our previous projects we looked for a framework and/or design pattern to use for the development of our RIA. We used the Cairngorm Framework, developed by Iteration::two which was the only mature Framework then, described by Steven Webster and Alistair McLeod in their book “Developing Rich Clients with Macromedia Flex”. Since Flex also works with ActionScript 2.0, Cairngorm would be suitable for Flash as well.
That Framework is quite extensive and the question was if the effort for using Cairngorm would be in proportion with the total costs and efforts for the whole project.
We decided to use a simplified pattern, on which Cairngorm in fact is based on: the Model-View-Controller (MVC) design pattern. Colin Moock described how to use the MVC framework in ActionScript 2.0 .
What are the MVC components?
• The model contains the data;
• The view handles the user interface;
• The controller handles the actions and changes.
The MVC principle is also used in, for example, Java development and can be used in many more (object oriented) languages.
Christobal Baray, on March 1999, describes the following advantages of the MVC design pattern:
• Clarity of design;
• Efficient Modularity;
• Multiple Views;
• Ease of growth;
• Powerful user interfaces.
So, MVC has been around for quite a while, but it is still going strong! Especially the last bullet is imperative for RIA development in our UxP (User Experience) business unit.
In our project , I made one general view and controller, which handles the general interface elements (like the menu in the upper toolbar and some buttons) and things like automatically logging in and sending keep-alive messages to sustain the session with the XML gateway.
For all the screens in the application, a new view was created. When a screen change is needed, a ScreenChange event is broadcasted, and the Flash movie is sent to the corresponding frame. The views react to the event by becoming visible or invisible. If a view needs to become visible for the first time, it first creates his interface components and then shows itself. This just-in-time principle made the performance experience much better, from an unacceptable initialisation time to a very quick one (quicker that the Java Applet!).
Views each have a MovieClip object called “screen” on which all interface components are created. Sometimes they have some shared components with other views, which are put on another MovieClip component called “panel”.
We’ve combined some of the original screens to make the usage of the application faster and surveyable. We’ve changed the dialogs where the user had to browse through a lot of screens to a datagrid interface which is filled while the user can scroll through it. Clicking on an item displays more detail information instantly while previously the user had to enter the line number of the item and type the code for “detail” to see it.
And sure, most of the interaction can be done via the keyboard. There are some differences in text screen based interfaces and point-and-click mouse driven interfaces. The big difference here was the introduction of an “OK”-button. In the original application input ended when the last character of the last input field was entered, giving the user no change to correct errors!
The period in which the application was launched, was just before a busy time when a lot of customers made their reservations. The new interface was introduced on a convention the client holds every year for her customers. Besides the publication of the new link on the extranet, no more publicity was given about the new product.
The customer wasn’t sure if the people who were used to the old application would be triggered to use the new one because of their habit of using the “fast” one. And would the users be willing to use a new system in the busiest period of the year?
The new application was in one aspect slightly slower than the old one, and that was the time it takes for the XML gateway to send and receive XML messages. But, because of the combination of some old screens to one and the availability of information without the previously needed user interaction makes it much quicker!
We closely monitored the usage of the new system and found that in the first days a lot of customers just took a look at the application. And in only a few weeks after that, already 15% of the reservations were being made via the new application!
Sid B. Dane
Here are some links you perhaps find useful:
What are Rich Internet Applications?
Macromedia Flex product information
What is a Firewall?
What is a Framework?
The Cairngorm Framework for Flex
Book: Developing Rich Clients with Macromedia Flex (Webster/McLeod)
Flash ActionScript 2.0 Learning Guide
Book: Essential ActionScript 2.0 (Colin Moock)
The Model-View-Controller Design Pattern
Christobal Baray: MVC introduction
The MVC framework for Macromedia Flash including a Clock example