Author Archives: wojciech

Some useful RIA links

I believe that those links are worth mentioning, RIA & Flex communities:

Some other very interesting links:

I believe that list of other links, strongly related to the Flex and Actionscript 3, will be also helpful. Please, give me some time to choose some from my bookmarks :)

Posted in AIR, Flash, Flex, Front-end, RIA, Silverlight | 1 Comment

Flex Architecture Frameworks

Why bother to use frameworks?

I believe that Flex it is more than name, it describe the environment itself. It’s friendly for developers, flexible to maintain changes, new requests and functionalities, design changes and improvements. It is also very extensible. We can create, share and use hundreds of libraries, components or frameworks.

Flex projects are meant to be internet RIAs, big loads of code created to be fulfilled with very interactive functionalities. With Flex we can deliver products which bring new quality to the Internet sites. Developing those applications usually require couple of visual components, some Web Services connections and adding some Actionscript to tie everything up and here we go! We’ve got RIA. Results tend to be amazing comparing to small amount of effort.

That’s one of today’s software development features. Develop rapidly.

But what happens when we are facing functionality changes, interface improvements, changing Web Service to AMF? Need of adding new module? What if we are given with new developer into existing project? Well… It depends on how much effort did we make to write an application, but usually it is the same. Nightmare :)

So why bother to use architecture framework? Why need to learn couple of more approaches which on the first look scares everyone with complicity?

  • Because we got a free ride to well organized application and we can focus on developing amazing stuff rather than thinking of complexity of the architecture.
  • Because we don’t want to spend another days thinking how make last five client’s changes.
  • Because we can develop the most important parts in the same way while we can focus on launching interaction into outer space :)

Well organized app?

I believe that some of the most important strengths of well organized architecture of application should:

  • isolate parts of application, visual components from communication, events, model that store data and actions – for simplicity and clarity,
  • keep the interface and model code simple as possible – since they are the most adjusted part of the application,
  • be able to resist frequent or unpredictable changes while maintaining the same, high level of quality,
  • make it easy to test and develop occurring bugs,
  • be easy while developing independently of the others,
  • make it possible programming tasks parallel so can be carried by different people,
  • provide a very high user experience with clear feedback and lack of latency.

Two words can cross your mind while reading those points: Isolation and Encapsulation. They are foundation for most of the frameworks, specially based on MVC architecture.

Two words regarding to MVC

Ok, not only MVC, but rather MVCS, as they are most popular in Flex enviroment. We are speaking about “Model-View-Controller-Service” approach.

  • Model (or State) – its objects are what the application knows, information about world modeled by our code. When it changes, using events it informs View to update user interface.
  • View (or Presentation, or Presentation and Interaction) – View objects are the interactive and graphic surface of the builded application. It presents information to the use, and respond to her/his interaction by invoking actions in the Controller.
  • Controller (or Action) – it implements what the application does, modifying model, invoking services to communicate the world outside.
  • Service (or Communication) – Service objects are how the application talks to the world outside, it populate objects of the Model using information collected from others :)

For people who see this for the very first time it’s more than abstraction. But believe me, it’s more simply than it looks like.

Flex dedicated architecture frameworks

Ok, coming back to the story line – I had tried and worked with some frameworks for Flex. Knowing each of them is connected with need to learn some design patterns, sometimes more advanced, but that’s another story. Generally, worth of mentioning are some of frameworks.

How evaluate effectiveness and quality of the framework? I believe that those are important:

  • approach – documentation, adoption, community & shared knowledge,
  • scalability – testable code, encapsulation, changeable, parallel development, modularity,
  • flexibility – open source license, internal & external dependencies (like .NET, Java etc.).

Adobe Cairngorm
http://labs.adobe.com/wiki/index.php/Cairngorm
My favorite. Developed and maintaned officialy by Adobe while having very big community. Well documented, open sourced, based on best patterns taken from Java and .NET and very extensible.

Using Adobe words:

“The Cairngorm Microarchitecture is a lightweight yet prescriptive framework for rich Internet application (RIA) development.

Cairngorm is an implementation of design patterns that the consultants at Adobe Consulting have successfully taken from enterprise software development (with technologies including J2EE and .NET) and applied rich Internet application development using Adobe Flex.”

Biggest project created in Making Waves with Adobe Cairngorm so far is Vattenfall Energy Calculator. Project had to be changed couple of times during development, we had pretty big model and communication. Cairngorm passed tests for A+

Cairngorm Diagram

PureMVC
http://puremvc.org/
Cairngorm’s best competitor. While Cairngorm is made only for Flex, PureMVC is Actionscript framework that can be used with Flash, Flex or pure Actionscript code. It has very clean implementation and is well documented. Cliff Hall, founder of the PureMVC states that this framework solves many problems that can be found while using Cairngorm framework. I believe – depends on what are you looking for :)

In Cliff Hall’s words:

“ PureMVC is a lightweight framework for creating applications in ActionScript 3, based upon the classic Model-View-Controller design meta-pattern.

This free, open source framework does not depend on any Flash, Flex or Apollo classes, and is therefore suitable for architecting applications on any platform running AS3.”

Sometimes it turns out that this dependency is advantage.

PureMVC

Model-Glue: Flex
http://www.model-glue.com/flex.cfm
Model-Glue is framework based on MVC. First it was ported to ColdFusion and Java. Framework itself is interesting, but lacks documentation and some approaches appears to be immature. In their words:

“Model-Glue: Flex brings implicit invocation, Model-View-Controller design, and cleaner, less repetitive integration with backend services to Flex 2.0 and AIR applications.”

Flest Framework
http://code.google.com/p/flest/

“Flest is an ActionScript3 / Flex application framework for building enterprise level RIAs. It uses such design pattern as Controller, Factory, Command, etc. High efficiency, simplicity and practicality were set as its mandatory design features.”

Although the framework operates with Model, Controller, Command and view State, should not be considered as MVC implementation due to keeping Model and View together and representing Commands as closures, functions that can run in a context of given object.

In my opinion this framework lack of documentation and implementation details are not so encouraging.

YOUR-OWN Framework
Well, actually there is no need for using any of those. If you are developing yourself or you have relatively big experience and code with someone on the same level – you can try to use this solution. However I strongly suggest deep understanding of MVCS and proven design patterns. Keep in mind that introducing someone new to your project might take a lot of time.


Conclusion

There are many more frameworks, I wanted to focus on the main ones. Using architecture framework help our own work. We can make them more stable, flexible, modularized and able to be developed parallel without any misunderstandings between developers. I strongly recommend Cairngorm as our main framework, due to many of its benefits. I hope that you have enjoyed this small introduction to Flex frameworks and I will be able to write some introduction to Adobe Cairngorm soon.

See your comments in my code,
Wojciech Ptak,
RIA consultant & Flex developer
Making Waves

Posted in Flex, Front-end | Tagged , , , , , , | Leave a comment