--- In [email protected], Laurence MacNeill <lmacne...@...> wrote:
>
> At 05:32 PM 5/14/2009, you wrote:
> 
> 
> 
> >You can just handle the click event from your button and in the 
> >handler function pull the necessary information out of your 3 custom 
> >components and then do what you want with it.
> 
> Right -- but don't I have to have those components dispatch their own 
> events in order to pull data from them?  At least, as I understand 
> it, that's the best practice.  What you're telling me to do (if I'm 
> understanding) would tightly couple my form with the components, 
> because I'd be accessing stuff that's supposed to be internal to the 
> components, right?

I have a really hard time figuring out why people recommend passing information 
in custom events.  It results in overly tight coupling, IMO, because both the 
component dispatching the event and the one receiving the event need to have 
that custom event compiled into them (so in addition to tight coupling it also 
bloats your file size).

I think it's much better practice to simply make public properties on your 
components available, and then just go read those properties when the event 
fires.

I know that there are a few cases where it makes more sense to use a custom 
event, but in most cases it's just extra work, extra file size, and extra tight 
coupling for little gain.

HTH;

Amy

Reply via email to