Tag Archives: Template Method

Code Refactoring 8

Code Refactoring 8In this part of my code refactoring tutorial, I’ll show you how to eliminate duplicate code using the template method pattern. If you want to see another example of the template method pattern, I cover it here as well Template Method Design Pattern.

When objects perform similar steps in the same order, that is a sign that a template method is needed. To use it implement the similar code in a template method and allow subclasses to override the behavior that varies.

The video and the code below cover all that you need to know.

Continue reading Code Refactoring 8