The Artima Developer Community
Sponsored Link

EventSource interface



This page contains an archived post to the Design Forum (formerly called the Flexible Java Forum) made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.


EventSource interface

Posted by Bill Venners on 20 Aug 1998, 8:41 AM

> Bill,

> I wish you (and JavaSoft) had taken this idea just one step further. There is still one piece missing from this idiom, specifically: An EventSource interface!

> For example, in your Telephone example, it would be nice to have a TelephoneEventSource interface. That way, when I want to use this instance of the idiom again, the compiler will force me to make sure that I've implemented all the methods correctly. Also, this further abstracts my listener from the implementation object by allowing it to only rely on the generic interface.

Yes, this is a good idea that someone also e-mailed me about.
I think the idea makes a lot of sense and think that it
deserves mention as a Variant of this idiom. Because JavaBeans
doesn't talk about an eventsource interface, I don't think it
should probably be the part of the "standard recipe."

As you mention, using an event source interface would make
the design more flexible. In the telephone example it seems
quite plausible that many classes of objects might want to
generate telephone events.



Sponsored Links

Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us