design-patterns The Strategy Pattern Pattern

  • Design Principle : Identify the aspects of your application that vary and separate them from what stays the same
    Not all in the application vary !!! Or you have a problem
  • Design Principle : Program to an interface, not an implementation
  • Design Principle : Favor composition over inheritance (has-a can be better than is-a)

    Composition
    Seperating what Chanage with an Interfcae
    Using composition to add behavior

The Strategy Pattern

Defines a family of algorithms encapsulating each one, and makes them interchangeable.
Strategy lets the algorithm vary independently from the clients that use it

Pattern

Creational

Singleton

Builder

Abstract Factory

Factory Method

Prototype

Behavioral

Mediator

Visitor

Iterator

Template Method

Command

Memento

Chain of Responsability

State

Strategy

Structural

Observer Pattern
The Observer Pattern defines a one-to-many dependency between objects so that when one object changes state, all of its dependents are notified and updated automatically.