Home > Design Pattern > Brief introduction about cairngorm

Brief introduction about cairngorm

Hi to all, I have been developing widgets using flex for the past two months and i have not developed using any MVC framework. When people told me that flex application should be developed using cairngorm i have not taken seriously because they have not given reason for why it should be developed with cairngorm. But today i have learnt from my mistakes and known why it should develop with cairngorm and also wish to spread an awareness about importance of cairngorm. here it goes.

Cairngorm is mostly used & well known micro architecture for building and integrating flex application with services. It has been in constant use since flex 1.5 , all because of once you have developed flex application then developer who have not been part of development of flex application can take over and continue the project without any hassles. To describe cairngorm in laymen perspective, it is nothing but divide the code in to logical functions. They are follows.

  • View
  • Model locator
  • Front controller
  • Command
  • Business delegate
  • Service locator


It describes user interface (UI) of flex application as well as it bounds the data in the model locator so that whenever the data in the model locator changes, the data bounded to the view will also be updated. so the user dont need to refresh the application when data changes, it will be updated automatically if it has bounded the data in the model locator.

Model locator

It is a centralized location for storing & retrieving data in flex application. It is a singleton class so that the user could not create more than one instance throughout the flex application. The user can retrieve and store the data in model locator using getInstance() static method which will return model locator instance and using that we can push & pop the data from model locator.

Front controller

The role of front controller is map the event name to the corresponding command class. When user triggers an event, the event class will inspect & redirect to corresponding command class which has been defined controller class.


Command class is the one which creates an instance of delegate class and also invokes method of the delegate class which in turn invokes services defined in the service locator. When the services has been invoked, the delegate will return control to command class and the result or the fault method will be executed depend on the result of service invocation.


The method defined in the delegate class will invoke the service using static method of service locator i.e. ServiceLocator.getInstance() which will return service locator instance and with the help of that we can invoke the service and also register the class which will handle the result of the service  invocation (generally it will be handled by command class)

Service Locator

This is where we will define all the services which we will invoke from  delegate class of our flex application.


Here i have tried to give an introduction about each  logical functions of cairngorm micro architecture. I have been trying to get good docs about cairngorm micro architecture for the past two months. once i have got, i will post more details about cairngorm in detailed manner. Thank you for reading this post.

  1. Priyanka
    November 15, 2010 at 5:52 am

    I want to know the Cairngorm architecture and life cycle in detail.
    Your piece of information truely helped me a lot.. But I want to know yet more about it.
    Could you please suggest some e-book or website for the same?
    Thank you in advance.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: