Strategy

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

Strategy Class Diagram

Examples:

Java AWT Layouts. The AWT Component instances act as strategy contexts allowing you to set the desired strategy implementation via the setLayout method. Classes BorderLayout, FlowLayout, CardLayout, etc., are concrete strategy implementations. Each of them encapsulates their own algorithm of laying out the components on AWT containers.



Last Updated: $Date: 2000/04/21 14:21:22 $ by $Author: jpl $