vault backup: 2025-01-17 17:10:15
This commit is contained in:
@@ -338,9 +338,27 @@ Forces:
|
||||
|
||||
> [!Note] Implementation Notes
|
||||
> - same notification interface for all observers on same subject (even if information needs are different)
|
||||
> - update() might carry new the updated data, or its just a ping and the observer needs to pull upon the notification
|
||||
> - no control over the order
|
||||
> - subject may need prevent modification of state until all observers were notified
|
||||
> - implementation is an interface and not a base class
|
||||
|
||||
Observer design patterns are often used with model-view-controller architectures
|
||||
![[Pasted image 20250117162946.png]]
|
||||
|
||||
Variation on the theme: Event Channel: many publishers and many subscribers
|
||||
#### Design Principles
|
||||
- high cohesion / loose coupling
|
||||
- design to invariants / design for change
|
||||
- encapsulation
|
||||
|
||||
|
||||
|
||||
> [!NOTE] Key Points
|
||||
> - pattern allows to notify many others when state changes
|
||||
> - decoupling of information provider from information consumers
|
||||
> - state data can be pushed on update() or pulled by observers
|
||||
> - event channels (variant) supports many publishers and many subscribers on the same channel
|
||||
|
||||
### Template Method
|
||||
|
||||
|
||||
Reference in New Issue
Block a user