Use the Template Method pattern when…

  • Common behavior can be factored out of an algorithm.
  • The behavior varies according to the type of a subclass.