Observer design pattern for animal B-ultrasound system
The observer design pattern of the animal ultrasound system is used to define a one to many dependency relationship between objects. When the state of an object changes, all objects that depend on it are notified and automatically updated. A common side effect of dividing a system into a series of collaborative classes is the need to maintain consistency between related objects. Developers do not want to tightly couple various types in order to maintain consistency, as this reduces their reusability.
The animal ultrasound system can use observer mode in any of the following situations:
1. When an abstract model has two aspects, one of which depends on the other. Encapsulate these two in separate objects so that they can be independently changed and reused.
2. When changing one object requires changing other objects at the same time, without knowing how many objects need to be changed.
3. When an object must notify other objects, but it cannot assume who the other objects are. In other words, you don't want these objects to be tightly coupled.
The key objects in the model of veterinary B-ultrasound system are targets and observers. A target can have any number of observers who depend on it. Once the state of the target changes, all observers are notified. As a response to this notification, each observer will query the target to synchronize its state with the target's state. This type of interaction is also known as publish subscribe. The target is the publisher of the notification. It doesn't need to know who its observer is when it sends out notifications. Any number of observers can subscribe and receive notifications.
link: https://www.bxlimage.com/nw/558.html
tags: animal B-ultrasound animal ultrasound veterinary B-ultrasound