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.

Table of Contents

Introduction

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


Benefits

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.

Return to Top


Examples of the pattern

A validation framework may choose which validation classes to use against an object, depending on it's type.

 

 

Return to Top


See Also

Link to domain parent articles and related articles in TechNet Wiki.

 

Return to Top


Community Resources

These are the external links, including links to Microsoft and TechNet sites that are non-Wiki

 

Return to Top


References section

Use this section if you pulled source material and ideas from other sites, blogs, or forums. Make sure you have permission from authors to use their material.

 

 

Return to Top