This article describes the Strategy design pattern. This is a behavioral design pattern, a category of design pattern used by software engineers, when writing computer programs.
The Strategy (or Policy) pattern is a design pattern, used in software engineering to define a family of actions or algorithms that can be selected depending on the object. It essentially keeps a set of pointers to functions and calls them depending on the object requirements. It is defined as a behavioral design pattern, because the actions depend on the object.
↑ Return to Top
It allows conditional processing depending on run-time values. The conditional processes themselves can be shared between classes, allowing reuse and abstraction of a function that can be altered without breaking the class that uses it.
A validation framework may choose which validation classes to use against an object, depending on it's type.