/*
Author: Jiangong SUN
*/
Strategy pattern principle is create a interface strategy with methods definitions. The concrete strategies will implement the interface. And context will use interface strategy. With different strategy contexts, different strategies will be called.
UML:
Implementation:
There is an interface who is the strategy, it defines a method signature.
Two concrete class implement it and its method.
In a context class, it uses interface strategy as its parameter in its constrcutor. Its execute strategy method will call the interface strategy method.
Usage of strategy:
reference:
http://en.wikipedia.org/wiki/Strategy_pattern
http://newguid.net/vs2008-vs2010/2010/design-patternsc-basic-example-strategy-pattern/
http://developer.51cto.com/art/201202/318911.htm