OO Programming in Java

EventCommand Pattern Support Material



Sometimes it is appropriate for one Observer to monitor several Observables. This was not the original intent of the Observer/Observable pattern which was to allow multiple views (Observers) to monitor a single model (Observable).

To allow a single update method to know what to do when it is called an 'EventCommand' object is passed as the 'Object' in the update call. Each EventCommand has an 'execute' method which is invoked in the EventCommandReceiver's update method .....

Java Implementation of EventCommand Pattern