The template method

This suggests providing a skeleton of an algorithm in operation, and deferring a few steps to subclasses. The template method lets subclasses redefine a few specific actions of a defined algorithm without changing the algorithm structure.

The following are the benefits:

  • Fundamental technique for code reuse
  • Allows partial implementation of business process while delegating implementation-specific portion to implementation objects (flexible in creating prototypes)
  • Helps implement the Hollywood principle (inverted control structure, Don't call us, we will call you)

Impacts are as follows:

  • Sequence of flow might lead to confusion
  • High maintenance cost and impacts are high on any changes to the code
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset