Design Pattern: Strategy Pattern in PHP

Strategy Pattern

Strategy pattern uses a group of similar algorithms and make those algorithms interchangeable. The client can use any of the algorithms at any given time and also can change the algorithm when needed. The algorithms used in strategy has the same interface implemented, but the internal working is different. This article demonstrates Strategy pattern implementations in PHP.

Design Pattern: Strategy Pattern in Java

Strategy Pattern

Strategy pattern is used when there are multiple algorithms available for the same purpose, and we need to decide between those algorithms. Strategy pattern helps to decide the algorithm and return the generated object to be used. This article demonstrates Strategy pattern implementations in Java. Check the following examples.