3.1 Announcements: an Object Dependency Framework
Announcements is a new framework for event notification developed originally by Vassili Bykov and which has been ported to several Smalltalk implementations. Announcements provides a simple and generic implementation of the Observer pattern.
Historically, Smalltalk implementations had a change/update mechanism, which forms the base of the MVC framework. One weakness of this mechanism is the use of symbols as events: registering to and triggering a notification are performed using sole symbols. Unfortunately, symbols are raw objects and can not contain other information. Take for example a
#changed event, which indicates a generic change in a model. Subscribers to this event receive no information about what has changed in the model. They must request such information from the model itself. Worse, it can be difficult to track down the source of an event when subscribed to the same event from multiple models.
Instead, Announcements promotes a fully object-oriented solution where events are plain objects. Such events-as-objects can be fully customized with contextual data specific to the application. A
ChangeEvent object can contain information such as the originating model, the nature of the change, or the trigger of the change...
If the notions of Observer pattern, Object Dependency Framework, or event notifications feels unusual, the next section provides a quick introduction to the problem addressed and principles behind the solution. Otherwise, you can safely skip this section and proceed to others.