O'Reilly logo

Professional Cairngorm™ by Jeremy Wischusen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required