Replace Template With Strategy

a varying concept is locked within a class hierarchy
capture the concept with an interface and extract the variation from the hierarchy

Context:

Eliminate Duplication By Inheritance essentialy leaves the code with a Template based structure that allows variation by subclassing thus coupling the varying concept with the class hierarchy.

Replace Template With Strategy decouples the variation from the class hierarchy by capturing the varying concept with an interface.

Replace Template With Strategy is a key refactoring in Evolving to the Strategy Pattern

See also : Access Subclass Features By Interface and Break Inheritance


Refactoring Thumbnails, Copyright © 2004 - 2005, Sven Gorts, All Rights Reserved.

[ Overview Page ] [ Thumbnail Catalog ]