I'm not the first person to care about this problem. (but it's a problem that I'd rather not care about, especially after I met Qt's Signals and Slots... Java beaten by C++? Come on!)
Note: I'm not talking about enterprise or distributed messaging, just typical event handling mechanism in a single application.
Here are some examples of people contributing solutions to Event Notification in one way or another:
- Hans Muller (Sun) in Generating Event Listeners Dynamically describes the problem and solution. It was pre-generics days so he came out with a solution involving reflection, proxies, 2,000 lines long and quite complex.
- GenericListener in c2wiki. Current solution involves a base class for all listeners. I definitely disagree with this technique.
- Nat Pryce's Easy Java Bean Event Notification. Using Reflection API and Java 5 Generics, the solution is quite concise and elegant, and (surprise!) conforms to JavaBeans(tm) Event Notification convention.
- Generic annotation driven event notification frameworks @ Stack Overflow.
- EventBus: How to Publish & Subscribe on the NetBeans Platform. Here's my overview on EventBus. More info on EventBus.org.
- Event Driven Architecture. Ideas of making event driven architecture using annotations and AOP.
The EventBus - www.eventbus.org - has had an open source pub/sub library for over 5 years. It's very cool, very simple.
ReplyDelete