Template Method: Same Routine, Your Own Step

When three label classes copy the same four steps and differ only in the barcode, a fix to the shared steps has to be made three times, and one copy is always missed; writing the routine once in a base class and letting each carrier's subclass fill in its own barcode is the Template Method pattern.

By

Updated

Cheat sheet: Template Method: Same Routine, Your Own Step
Category
Data Structures
Level
Journeyman
Tags
Abstract Method, Code Smell, OOP, Template Method Pattern