Our Blog

Dive into the latest trends, tutorials and insights in computer science. From AI advancements to coding best practices, our blog brings you a wealth of knowledge for tech enthusiasts and developers alike. Stay ahead of the curve with in-depth articles on programming, software development, cybersecurity and more!

Template Method

 Template method defines the skeleton of how a certain algorithm could be performed, but defers the implementation of those steps to the children classes.


Real world example

Suppose we are getting some house built. The steps for building might look like

  • Prepare the base of house
  • Build the walls
  • Add roof
  • Add other floors

The order of these steps could never be changed i.e. you can't build the roof before building the walls etc but each of the steps could be modified for example walls can be made of wood or polyester or stone.

Categories
Archive