Handling the view in Cairngorm with Presentation Model

Alot has happened since my rant about Cairngorm. My friend Børre Wessel has always told me to use a presentation model when working with Cairngormas a way to better separate the view from the model. So I have tried this approach a few times now on some small projects, and I have to agree that it really is a good way to sort out this issue.

Børre and I are of course not the only ones doing this.  Paul Williams put up a simple example on how to use a presentation model, but yesterday I found an even better article outlining how to use the same pattern with Cairngorm.
David Deraed has a post Cairngorm and Presentation Model Part 2: sample application on his blog Flex May Day which gives a step by step guide with source code on how to implement the Presentation Model pattern with Cairngorm. When reading the article make sure you read the comments too as they point out a few important aspects about the code sample. You might also want to read part 1 of the article to get some background.

Using the Presentation Model pattern is in my opinion the best way of resolving separation between model classes and the view.

September 3rd, 2008 | Flex

No comments