Strategy Design Pattern - PowerPoint PPT Presentation

About This Presentation
Title:

Strategy Design Pattern

Description:

Only one of them may be used depending on the context. ... B.Ramamurthy. 5. Mr.X and Strategy Design Pattern. 12/19/09. B.Ramamurthy. 6. Layout Example ... – PowerPoint PPT presentation

Number of Views:85
Avg rating:3.0/5.0
Slides: 7
Provided by: scienceand1
Learn more at: https://cse.buffalo.edu
Category:

less

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