Strategy AKA Policy Dale Willey Ian Price. Overview Definitions Difference between Strategy pattern and strategy Where would you use this? Challenges.

Slides:



Advertisements
Similar presentations
CS 350 – Software Design The Bridge Pattern – Chapter 10 Most powerful pattern so far. Gang of Four Definition: Decouple an abstraction from its implementation.
Advertisements

Unit 7 Generic Interfaces and Encapsulation, a Class in the Middle Kirk Scott.
OOP Design Patterns Chapters Design Patterns The main idea behind design patterns is to extract the high level interactions between objects and.
More Interfaces, Dynamic Binding, and Polymorphism Kirk Scott.
SWE 4743 Strategy Patterns Richard Gesick. CSE Strategy Pattern the strategy pattern (also known as the policy pattern) is a software design.
Plab – Tirgul 12 Design Patterns
Observer Pattern Fall 2005 OOPD John Anthony. What is a Pattern? “Each pattern describes a problem which occurs over and over again in our environment,
Patterns – Day 8 Adapter continued Facade Reminders: Faculty candidate talk Friday 4:20 PM O-267. Brian Postow: Games and Complexity Theory No class tomorrow.
1 (More) Pattern Games CS : Software Design Winter /T10.
STRATEGY Object Behavioral Pattern. You are at the Pub two weeks before Fall Formal and still don’t have a date! All of a sudden a girl who you had a.
Marcelo Santos – OOAD-CDT309, Spring 2008, IDE-MdH 1 Object-Oriented Analysis and Design - CDT309 Period 4, Spring 2008 Design Patterns: someone has already.
ECE 355 Design Patterns Tutorial Part 2 (based on slides by Ali Razavi) Presented by Igor Ivković
PRESENTED BY SANGEETA MEHTA EECS810 UNIVERSITY OF KANSAS OCTOBER 2008 Design Patterns.
CERN – European Organization for Nuclear Research GS Department – Administrative Information Services Design Patterns in Groovy Nicolas Décrevel Advanced.
1 An introduction to design patterns Based on material produced by John Vlissides and Douglas C. Schmidt.
Family Communication April 2, 2007.
Chapter 1: Introduction to Design Patterns. SimUDuck Example.
02 - Behavioral Design Patterns – 2 Moshe Fresko Bar-Ilan University תשס"ח 2008.
1 GoF Template Method (pp ) GoF Strategy (pp ) PH Single User Protection (pp ) Presentation by Julie Betlach 6/08/2009.
Case Studies on Design Patterns Design Refinements Examples.
Limits Involving Infinity Chapter 2: Limits and Continuity.
©Fraser Hutchinson & Cliff Green C++ Certificate Program C++ Intermediate Decorator, Strategy, State Patterns.
Outline Sec. 2-1 Direct Variation Algebra II CP Mrs. Sweet.
 How are you going to collaborate?  How are you going to divide up work?  How are you going to make sure that changes work with other people’s code?
Chapter 26 Chi-Square Testing
CS 350 – Software Design The Strategy Pattern – Chapter 9 Changes to software, like other things in life, often focus on the immediate concerns and ignore.
Strategy Design Patterns CS 590L - Sushil Puradkar.
GoF Sections Design Problems and Design Patterns.
Unit 4 Object-Oriented Design Patterns NameStudent Number CAI XIANGHT082182A KYAW THU LINHT082238Y LI PENGFEIHT082220L NAUNG NAUNG LATTHT082195L PLATHOTTAM.
Behavioral Pattern: Strategy C h a p t e r 5 – P a g e 205 The Open-Closed Principle advocates designing software in such a way that it will absorb new.
ECE450 - Software Engineering II1 ECE450 – Software Engineering II Today: Design Patterns VIII Chain of Responsibility, Strategy, State.
Design Patterns Yonglei Tao. Design Patterns  A design pattern describes a recurring design problem, a solution, and the context in which that solution.
The Builder pattern Shuanghui Luo. Type & intent One of the Creational PatternOne of the Creational Pattern Intent:Intent:  Separates the construction.
Arbitrage Pricing Theory
Gang of Four Patterns 23 total 15 useful How are they different from GRASP Patterns?
Design Patterns References: Xiaoping Jia, Object-Oriented Software Development Using Java;Douglas C.Schmidt, Design Pattern Case Studies with C++
STRATEGY PATTERN. Design Pattern Space Purpose ScopeCreationalStructuralBehavioral ClassFactory MethodAdapterInterpreter Template Method ObjectAbstract.
The Strategy Design Pattern © Allan C. Milne v
Stéphane Ducasse 1 Strategy.
The Strategy Pattern (Behavioral) ©SoftMoore ConsultingSlide 1.
Example to motivate discussion We have two lists (of menu items) one implemented using ArrayList and another using Arrays. How does one work with these.
CS 210 Proxy Pattern Nov 16 th, RMI – A quick review A simple, easy to understand tutorial is located here:
Multi Dimensional Variance: How to make ultra flexible software!
Five Minute Design Patterns Doug Marttila Forest and the Trees May 30, 2009 Template Factory Singleton Iterator Adapter Façade Observer Command Strategy.
Patterns are Roles What patterns are and what not…
Overview of Creational Patterns ©SoftMoore ConsultingSlide 1.
Duke CPS Programming Heuristics l Identify the aspects of your application that vary and separate them from what stays the same ä Take what varies.
STRATEGY PATTERN By Michelle Johnson. BACKGROUND Behavioral Pattern Allow you to define a family of algorithms, encapsulate each one, and make them interchangeable.
Overview of Behavioral Patterns ©SoftMoore ConsultingSlide 1.
By SmartBoard Team. Agenda  Scenario & Writing UML  Discuss with each team’s UML  What if…  BMVV design  Strategy pattern  Applied with BMVV design.
Strategy: A Behavioral Design Pattern
Strategy Design Pattern
Strategy Pattern Jim Fawcett CSE776 – Design Patterns Fall 2014.
Strategy Pattern.
GoF Patterns (GoF) popo.
Design Pattern Aside Why you should read extensively and often
Introduction to Design Patterns
CS 350 – Software Design The Strategy Pattern – Chapter 9
Chapter Nine The Strategy Pattern
More Interfaces, Dynamic Binding, and Polymorphism
Strategy Design Pattern
Presented by Igor Ivković
Designing Algorithms for Multiplication of Fractions
Strategy Design Pattern
Introduction to Design Patterns
Design Patterns (Gamma, Helm, Johnson, Vlissides)
Presented by Igor Ivković
Thinking Multiplicatively: From Arrays to the ‘Area Model’
Strategy Pattern Jim Fawcett CSE776 – Design Patterns Fall 2014.
Presentation transcript:

Strategy AKA Policy Dale Willey Ian Price

Overview Definitions Difference between Strategy pattern and strategy Where would you use this? Challenges

Definitions (Metsker) Encapsulate alternative strategies, or approaches, in separate classes that each implement a common operation. (GoF) Define a family of algorithms, encapsulate each one, and make them interchangeable. Strategy lets the algorithm vary independently form clients that use it.

What That Really means... Multiple functions that take the same arguments and return something of the same type.

Strategy Pattern vs strategy strategy is a single way of doing things Strategy Pattern is applying different strategies Discussion?

Questions so far...

Example: Playing Monopoly How could the strategy pattern be applied here? What different strategies are there?

President’s Cabinet In the context of the President’s advisors, how could the strategy pattern be applied here? What different strategies are there?

VCR Does a VCR implement a strategy pattern with respect to playing tapes? With setting the clock? A single VCR? All VCRs?

Challenges Reexamine the definitions... (Metsker) Encapsulate alternative strategies, or approaches, in separate classes that each implement a common operation. (GoF) Define a family of algorithms, encapsulate each one, and make them interchangeable. Strategy lets the algorithm vary independently form clients that use it. What kind of relationship are they describing? 1-1? 1-∞?

Challenges (cont) How is this like Chain of Responsibility?

Challenges (cont cont) Are business contingency plans Chains of Responsibility or Strategies?

Challenges (cont cont cont) Is a random Chain of Responsibility a Strategy?

Challenges (still cont) Is a completely predictable way of applying strategies a Strategy pattern? Is maxing the bet every time in poker (constantly bluffing) an example of a Strategy pattern?

Review Strategy Pattern uses 1 to n strategies in a modular way The point to the Strategy Pattern is in having and using strategies rather than emphasis on the selection method