Observer Pattern Pros & Cons
Pros:
- Supports the principle to strive for loosley coupled designs between objects that interact.
- Allows you to send data to many other objects in a very efficient mannor.
- No modification is need to be done to the subject to add new observers.
- You can add and remove observers at anytime.
Cons
- Java’s built in class Observable forces the use of inheritance vs programming to an interface
- Observable protects crucial methods which means you can’t even create an instance of the Observable class and compose it with your own objects, you have to subclass.
- If not used carefully the observer pattern can add unecessary complexity
- The order of Observer notifications is undependable