Skip to content

Latest commit

 

History

History
41 lines (23 loc) · 1.36 KB

README.md

File metadata and controls

41 lines (23 loc) · 1.36 KB

##Design Pattern

  • Whats is?

"Each pattern describes a problem which occurs over and over again in our environment, and then describes the core of the solution to that problem, in such a way that you can use this solution a million times over, without ever doing it the same way twice" - Christopher Alexander says

###Strategy

Define a family of algorithms, encapsulate each one, and make them interchangeable. Strategy lets the algorithm vary independently from clients that use it. - Gof

###When to use the Strategy?

  • When you want to define a class that will have one behavior that is similar to other behaviors in a list:

    • Not flying
    • Flying fasts
    • Flying with rocket
  • When you need to use one of severel behaviors dynamically

  • Often reduces long lists of conditonals

  • Avoid duplicate code

  • Keeps class changes from forcing other class changes

  • Can hide complicated

###Problem?

  • Increased number of Classes.

###UML sample.

PlantUML model