Strategy Pattern

What is Strategy Pattern? Strategy pattern is a commonly used behavioural pattern. Strategy Pattern is mostly a way to change the behaviour of an algorithm at runtime. The strategy pattern: defines a family of algorithms, encapsulates each algorithm, and makes the algorithms interchangeable within that family. Consequences Think twice before implementing this pattern. You have to be sure your need is to change an algorithm frequently. You have to clearly anticipate the future, otherwise, this pattern will be more expensive than a basic implementation. + Greater flexibility, reuse + Can change algorithms dynamically - Strategy creation & communication overhead - Expensive to create - This…

Continue Reading
Close Menu