Strategy Design Pattern PowerPoint PPT Presentation

presentation player overlay
About This Presentation
Transcript and Presenter's Notes

Title: Strategy Design Pattern


1
Strategy Design Pattern
  • 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.

3
Strategy Design
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.Xs strategies in the ScotlandYard game.

5
Mr.X and Strategy Design Pattern
6
Layout Example
Write a Comment
User Comments (0)
About PowerShow.com