Thanks for replying. Lets talk about MVC. there are two different implementation of MVC. One is Event driven, Which means call The Model(Service) in Action. In JAVA Framework, JSF is the one. Another is Action driven. Which means dispatch and Central listen. like Struts in Java.
I think my solution just call the Service in Every Flex Action. not Dispatch to a Central controller. The benefit is The logic is much more clear. and It is much more easier to maintain, Because You always know which service is used in the Exactly Flex Action(event). compare the Cairngorm workflow: View-->Action-->dipatch event--> frontcontroller-->command-- >delegate--->sevice Locator-->Modellocate--->View. To: View-->Action-->Service Facade-->Delegate-->Service locator-->Model locator-->View I relly think my way is much more easier and clearer. Cheers Mike --- In flexcoders@yahoogroups.com, "ben.clinkinbeard" <[EMAIL PROTECTED]> wrote: > > 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" <MichNiu@> 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 > > >