Software Engineering, 2012 Design Patterns – Behavioral patterns 28 Observer: Considerations (2) avoiding observer-specific update protocols push model: subject sends its observers detailed information about the changes pull model: subject only informs observers that state has changed; observers need to query subject to find out what has changed specifying modifications of interest explicitly of interest when observer are interested in only some of the state-changing events: Subject.attach(Observer, interest) Observer.update(Subject, interest) encapsulating complex update semantics when there is a highly complex relationship between subject and observer, introduce a ChangeManager class to reduce the amount of work.
{"Image DocumentName": "Observer: Considerations (1)", "Image ImageDescription": "Sometimes observers need to observe more than one subject. who triggers the update? state-changing subject methods call notify() method, or. make clients responsible for calling notify(). avoid dangling references when deleting subjects. -- Subject notifies its observers about its deletion. make sure Subject\u2019s state is self-consistent before calling notify (the observers will query the state).", "Image XResolution": "37", "Image YResolution": "37", "Image ResolutionUnit": "Pixels/Centimeter", "Image Software": "SlidePlayer", "Image YCbCrPositioning": "Centered"}