First of all, I'm no Cairngorm expert and I'm not going to criticise a 
reference implementation.

For a store application (any store) I would consider that the model would 
hold details of the stock items and the baskets of any shoppers. I wouldn't 
have the model keep track of what the shopper is currently doing, because 
that's not something that affects the shop stock or the users basket. The 
view on the other hand is concerned with what the user is doing and needs to 
keep track of the view state in order to manage the interface.

In this respect I would be using constants to represent view states but they 
would be constants associated with view classes not model classes.

My feeling is that model classes need to be as far as possible separate from 
the view, so that in theory you could replace the view implementation 
without changing the model at all.

Inevitably there is a coupling between view and model but it's in terms of 
how the model is manipulated and accessed by the view.

That's how I think about these things. I've been wrong before and will be 
again and I have no criticism for the Cairngorm Store.

I'm not sure that's helpful.

Paul


----- Original Message ----- 
From: "Justin J. Moses" <[EMAIL PROTECTED]>
To: <flexcoders@yahoogroups.com>
Sent: Tuesday, September 02, 2008 12:33 AM
Subject: [flexcoders] Re: Question about Best Practices for Applications 
with many views using Cairngorm


> Paul,
>
> If you're trying to understand Cairngorm by reading the docs and
> going through the Cairngorm Store demo, you'll notice that the views
> are toggled via constants in the model:
>
> eg.
>
>
> if( model.workflowState ==
> ShopModelLocator.VIEWING_PRODUCTS_IN_THUMBNAILS )
>
> ...
>
>
> so the various views or different features/sections that the user sees
> in the store are:
>
> ShopModelLocator.VIEWING_PRODUCTS_IN_THUMBNAILS
> ShopModelLocator.VIEWING_PRODUCTS_IN_GRID
> ShopModelLocator.VIEWING_CHECKOUT
>
>
> So that would explain why both the original poster and myself, would
> assume that for various features in your own app - such as a "My
> Profile", "Inbox", "Contacts" for an email application for example -
> would have to be handled by a viewstack and a list of constants.
>
> Do you think the Cairngorm Store app has been written with inherent
> flaws? If so, then how would you rewrite it to illustrate the
> behaviour you mentioned before?
>
> cheers,
> Justin
>
>
> ------------------------------------
>
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Search Archives: 
> http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups 
> Links
>
>
>
> 

Reply via email to