Enum , Strategy pattern, Open/close principle - Strategy design pattern - is based upon open closed design principle, the 'O' of famous SOLID design principles. Strategy pattern allows to encapsulate possible changes in a process and encapsulate that in a Strategy class. By doing that your process (mainly a method) depends upon a strategy, higher level of abstraction than implementation. This makes your process open for extension by providing new Strategy implementation, but closed for modification, because the introduction of a new strategy doesn't require a change in a tested method. That's how it confirms open closed design principle.Strategy pattern is one of the famous pattern, which takes advantage of polymorphism, to remove switch cases and strive for open close design principle. Formally it encapsulate related algorithm, known as strategy and make them interchangeable. open/closed principle - In object-oriented programming, the open/closed principle s...
Comments
Post a Comment