SE450: Patterns: Strategy vs. Template Method [15/41] Previous pageContentsNext page

Strategy is a good example of Subtyping

Template Method is a good example of Subclassing

Strategy helps you define a family of similar algorithms

Template Method helps you define a skeleton of an algorithm

Strategy allows you to code to a common inteface and change implementations easily by plugging in new algorithms

Template Method allows you to code portions of an algorithm once, allowing subclasses to modify or enhance the behavior of the algorithm

Previous pageContentsNext page