Skip to content

Template Design Pattern

Devrath edited this page May 24, 2021 · 4 revisions

Why we use this pattern

  • Assume we have a module that does a transaction, and whenever this transaction is done we need to record this transaction.
  • Recording the transaction is a template for a task. Because of this, we call it a template design pattern.
  • We can have an abstract class that defines the common code for the task and along with it, we can have an abstract class to be overridden in its child class.
  • Now we can extend this abstract class and in the child class and have the additional implementation like making the transaction.
  • This abstract class has a template that can be used in children.

Projects
BankExample

Project: BankExample

Toolbox