posted 19 years ago
Hi,
I am thinking about usual UI design problem. How component or controller notifies it's owner about events. I see 2 solutions:
1. Use chain of responsibility and pass event until someone handles it. Basicaly we get single listener (or method) for all events. So you just add single listener for all events.
2. Use multiple listeners each for it's own event. This way only interested components are notified.
In this case I tend towards "2.multiple listeners". In example, I have child component contained by parent. In the parent I can expose any events child may throw. I can pick up which ones to expose and which ones to hide. This functionality is also possible with Chain of Responsibility, but CoR does not provide clear contract in form of addListenerForEventA, addListenerForEventB. It's hard to tell what events are handled where, using CoR.
Any suggestions to support or to criticize my thinking? I am grateful for both!
With best regards,
Vladas