Q&A
- How is Mediator different compared to the Observer pattern?
Both patterns work in a similar manner; however, their goals are marginally different. The goal of the Mediator is to eliminate direct communication between system components. With a Mediator, you usually know the dependent structures and perform calls based on the events that it receives. With Observer, you are slightly more loosely coupled as the publisher does not identify the details of the subscriber list. Some subscribers might choose to ignore certain messages, and some may choose to respond to them.
- How is the Chain of Responsibility different compared to the Decorator pattern?
The Decorator pattern usually extends one object's behavior and does not try to block the flow of requests. With a Chain of Responsibility, you are allowed to break the flow under certain criteria.
- How is Visitor different compared to the Composite pattern?
The Visitor pattern works together with the Composite...