1 / 9

STRATEGY

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 crush on during o-week walks in.

cody-duffy
Download Presentation

STRATEGY

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. STRATEGY Object Behavioral Pattern

  2. 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 crush on during o-week walks in There are many different ways that you could approach this situation. Each approach requires a different methodology, but achieves the same goal (i.e. you have confronted your crush)

  3. How you doin?

  4. Do you believe in love at first sight or should I walk around the room again?

  5. Intent of Strategy • Define a family of algorithms, encapsulate each one, and make them interchangeable • Strategy provides a common interface for all encapsulated algorithms and allows the algorithm to vary independently of the client

  6. When is Strategy used? • When many related classes differ only in their behavior • Different variants of an algorithm exist in order to reflect different space/time trade-offs

  7. Structure

  8. Airline Ticket Reservations • There are many different ways to obtain an airline ticket. Depending on your utility for time and money, you may be looking for the cheapest flight available or you might want to find the quickest flight to your destination.

  9. Airline Ticket Reservations

More Related