26.2. RIA Development with Cairngorm: Adobe Max Presentation

Eric Garza and Peter Martin of Adobe Consulting laid out their ideas for best practices in a presentation titled "RIA Development with Cairngorm: Tips from the Experts" given at Adobe MAX in 2008. I've chosen to cover some of their tips that either supplement or provide some contrast with those put forth by Jesse Warden.

Garza and Martin suggest that commands should not reference the model directly. Instead they suggest that callback functions be provided on the event and that these responder functions be used to update the model. This involves the creation of additional responder classes, which would look something like what follows.

A view dispatches an event that registers responder functions:

public function loadData() : void {
new SomeEvent(resultHandlerFunction, faultHandlerFunction).dispatch();
}

Commands then pass these responder functions on to the delegate by creating one of the custom responder classes:

public function execute(event:CairngormEvent):void{
var evt : SomeEvent = SomeEvent( event );
var delegate : SomeDelegate = new SomeDelegate( new SomeCustomCommandResponder
(evt.resultHandler, evt.faultHandler ) );
delegate.getData();
}

Garza and Martin also recommend the use of the SequenceCommand class for triggering multiple commands from a single user gesture and for delegating classes to access services.

They make several suggestions regarding the use of the ModelLocator. These are:

  • Use data binding to ...

Get Professional Cairngorm™ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.