ModelLocator and Databinding (Enterprise Flex RIA and the Cairngorm Microarchitecture – The developer’s experience) November 7, 2006

Posted by Bjorn Schultheiss in : Cairngorm, Flex 2 , trackback

ModelLocator and Databinding.

The ModelLocator and the use of Databinding to bind model data to views is one of the key advantages of developing Flex RIA’s with Cairngorm.

The ModelLocator provides developers with a single point of reference to client model data objects. It is important in MVC RIA development to ensure that model object instances are contained in a single object that is accessible from any area of the application without unnecessarily needing to instantiate further objects or creating copies of the data. This solution is provided by the singleton design pattern.

Databinding is the mechanism used to display model data in your views. Binding removes the need to code your own event dispatching system to update your views with up to date model data. For Flash developers considering learning Flex, Databinding may be the biggest drawcard. The main benefit is the small amount of code required to use Databinding.
Code examples can be found in Cairngorm Diagram Explorer.
From Developing Rich Clients with Macromedia Flex, the sample pdf chapter on Databinding.

I manage my views with data from the model. For example I have created a Model Class called UIControlsModel. Within this Class I store all my presets for my UI’s layout. My model objects are all instantiated in my modelLocator constructor. This way I am able to maintain a set beautifully constructed series of model object structures for efficient use throughout my application.

Cairngorm is a very useful framework and I recommend anybody learning flex 2 to also learn Cairngorm.

My next post we be on Delegates, ServiceLocator and my experience using Tomcat on my Macbook pro…

I have also completed a lengthy article that I divided into 3 posts on my flex journal that is on my personal blog.

Flex RIA Articles - Part 1 (The Background)
Flex RIA Articles - Part 1 (Front to Back Development)
Flex RIA Articles - Part 1 (Prototyping and Architecture)

Regards,
Bjorn

Comments»

1. prashant - May 29, 2007

Hi,

I m new to cairngorm MVC pattern,& have done one project regarding flex+hibernate.
Its very useful link provided by you.

Thanks,
Prashant.


*
To prove you're a person (not a spam script), type the security word shown in the picture.
Anti-Spam Image