Presentation is loading. Please wait.

Presentation is loading. Please wait.

Strategy Design Pattern

Similar presentations


Presentation on theme: "Strategy Design Pattern"— Presentation transcript:

1 Strategy Design Pattern
B.Ramamurthy 2/28/2019 B.Ramamurthy

2 Strategy Often there are alternative ways or strategies to achieve a goal. These strategies are usually realized using algorithms. Only one of them may be used depending on the context. The algorithms representing the strategies can be encapsulated each in a class. Strategy pattern itself represents a collection of these alternative ways in a hierarchy of classes, each class representing an alternative. 2/28/2019 B.Ramamurthy

3 Strategy Design 2/28/2019 B.Ramamurthy

4 Examples Different layouts for graphical components (JFrame, JPanel, JApplet) Checkout counter software has TaxCalculator class. Depending on the place (context) the tax computation differs. Mr.X’s strategies in the ScotlandYard game. 2/28/2019 B.Ramamurthy

5 Mr.X and Strategy Design Pattern
2/28/2019 B.Ramamurthy

6 Layout Example 2/28/2019 B.Ramamurthy


Download ppt "Strategy Design Pattern"

Similar presentations


Ads by Google