Repository for my Design Pattern Learning.
Book: Head First Design Patterns. A Brain-Friendly Guide . By Eric Freeman, Elisabeth Robson, Bert Bates, Kathy Sierra
Dummy Questions:
- Why do we need to store a ref to Observable in Observers?
In the future, we may want to un-register ourselves as an observer - Why Observer Pattern provide us a loosely coupled system?
- We can add new observers anytime
- Changes to either the Observable or Observer will not affect the other
- No need to modify Observable to add new type of Observer: we just need to create a new class and implement Observer interface on it.
The Strategy pattern defines a family of algorithms, encapsulates each one, and makes them interchangeable. Strategy lets the algorithm vary independently from clients that use it.