--- In [email protected], "Tim Hoff" <timh...@...> wrote: > > > Don't agree. The smoke test for tight coupling is that if component A > is tightly coupled to component B and you take away component B, you get > a compiler error in component A. By using an event, that doesn't > happen. Component A dispatches an event that component B listens for. > If you take away the listener it doesn't break the dispatcher; and > vice-versa. Sure, the components both reference the event class. But, > with your logic, you're saying that two components that both use > mx:controls:button are tightly coupled together; because they reference > the same class.
That's one way of looking at it. I look at it like this: Component A and Component B both need Component C to operate, so if you take Component C out of the equation (OR OUT OF EITHER COMPONENT), neither one will compile or work, and Component C is only needed to facilitate communication between the two components. Given that there are vanishingly few situations that actually call for Component C in the first place, why create the unnecessary dependency. On the other hand, if you have two components that use Button, there are several very real differences. The first is that you don't have to make a custom Button to make it work... If you wrote a Button subclass that was extended in a way that wasn't necessary for the functionality, that would get closer to the analogy. But even then, you could remove Button or its subclass from either class without breaking the way the two interact. -Amy

