One of the core principles of not just Cairngorm but MVC in general is
for your views to be as dumb as possible. The less they know about
models, services, etc the better. You've essentially taken the
opposite approach. Creating reusable/generic views using your approach
wouldn't really be possible.

Also, Flex is an event driven architecture and events are another core
aspect of creating loosely coupled application components. I think
your approach will result in very brittle code that will be hard to
maintain.

Ben


--- In flexcoders@yahoogroups.com, "michniu" <[EMAIL PROTECTED]> wrote:
>
> Hi Coders,
> 
> I just want to discuss some issues about  the Cairngorm, Because I 
> cant find  another  mail list or  forum to   discuss it. I put it 
> here.
> 
> 
> The most useless part in cairngorm ----FrontCotroller and command
> 
> 
> Just on   my opinion, I really don't like to write the command for 
> every action and register it  on  FrontCotroller. I really think it  
> waste time, and It make debugging  difficult! Sometimes  you don't 
> know where do you get the result  after  you dispatched your  Event.
> 
> 
> 
> Use A  ServiceFacade to replace  the front controller and the command.
> 
>  I use  a ServiceFacade  to call the Delegate  instead of the 
> controller and the junk command. 
> 
> The idea is  when  the view page  active some action. it will not 
> dispatch any event .  it will call the  service method from  service 
> facade. 
> 
> Here  is  example code form  flexStore:
> 
>         private function onLoadCatalog():void {
>                       var event : LoadCatalogEvent  = new 
> oadCatalogEvent();
>                       event.dispatch();
>               }
> 
>  to replace the  event dispatch()  my solution is :
> 
>    private function onLoadCatalog():void {
>                                       
>       ServiceFacade.getInstance().loadCats();
>               }
> 
> 
> The ServiceFacade .loadCats() method   call the delegate  and service:
> 
> public  function loadCats():void {
>                       var handlers : IResponder 
>                                           = new     Responder
> (onResults_loadCatalog,fault);
>                       getDelegate(handlers).loadCatalog();
>               }               
> 
> 
> Use this way, I don't need  create any   front Controller and  
> command. I also get the benefit  from  Cairngorm  Service Locate  
> Delegate and Model locator.
> 
> 
> Any suggestion or Criticize  is Appreciated
> 
> 
> Mike
>


Reply via email to