Skip to content

Files

Latest commit

 

History

History

Starategy_Pattern

Strategy Pattern

Defines a family of algorithms, encapsulates each one, and makes them interchangable.
This pattern allows us the make "horizontal" reuse of code, instead of vertical (inheritance) - Uses composition rather then inheritance.

Example of use of Strategy Pattern: Arrays.sort(). The sorting algorithm can change irrespective of its' user's code.

UML diagram:

Alt text