Strategy Definition:
Define a family of algorithms, encapsulate each one, and make them interchangeable. Strategy lets the algorithm vary independently from the clients that use it.
IComparable is a good example of the Strategy pattern. IComparable defines a single member called CompareTo (Object o). This allows different classes to define different strategies for comparison. As long as the class implements IComparable and the CompareTo member, the implementation is up to the class itself.
Sunday, October 7, 2007
blog comments powered by Disqus
Subscribe to:
Post Comments (Atom)