Andrea Varga wrote:
> e_baggg wrote:
> 
>> Hello group-
>>  I hadn't seen a previous post regarding this explicity so I wrote a
>> small blog about it. It helps reduce the #of classes that get created
>> when using Cairngorm (a big issue with me since the client is VERY
>> picky with their swf file sizes). This blog shows the code for usuing
>> a reusable CairngormEvent versus creating separate classes for each
>> dispatchable event.
>>
>> http://ebaggg.blogspot.com/2006/08/cairngormevent-anti-pattern-we-all.html
>>
>> Thoughts?

I use a similar approach but i choose to keep the event ID's in the event 
themselves, not really much different just shifts a dependency from one place 
to 
another..

> 
> The ideea is good, but how do you handle them further?
> Will you have 3 different commands associated with the same event? And 
> each Command will start with an if statement, to see if that's the event 
> he supposed to answer to? Doesn't seem right.

Commands are looked up and executed according to the event ID so you can 
register the events and commands like this in the WidgetController :

addCommand(EVENT_ADD_WIDGET, AddWidgetCommand);
addCommand(EVENT_DELETE_WIDGET, DeleteWidgetCommand);
addCommand(EVENT_UPDATE_WIDGET, UpdateWidgetCommand);

no need for branching in the command.




--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to