My thoughts on Strategy: Strategy
Commentary
- Strategy and Observer Design Pattern
- Banger of a series. It was a great explanation, and it felt really enthusiastic.
- Strategy patterns are like polymorphism, but for a specific component or functionality. Like payment can be a strategy pattern, where we can implement UPI, card, net banking, etc.
- The strategy pattern is like implementing a family of algorithms and encapsulating the algorithms in their own, and we can make them interchangeable.
- Observer pattern is like a push strategy rather than the client polling it. It makes it efficient and clean. When the observable changes, it notifies (pushes) the changes to the observers, and then it can fetch the changes since it can decide what it wants.