Design patterns are proven solutions to recurring problems and complexities in software development.

Design patterns fall into three categories: creational, structural, and behavioral.

Creational patterns are used to create and manage instances of classes.
Structural patterns are used to realize the relationships among the entities.

Behavioral design patterns deal with object collaboration and delegation of responsibilities.Note that the template method pattern belongs to the behavioral design pattern category.
In the sections that follow, we will examine this design pattern in detail.[ Review: Visual Studio 2017 is the best ever. | Cut to the key news and issues in cutting-edge enterprise technology with the InfoWorld Daily newsletter. ]
Why use the template method pattern?
The template method design pattern is useful when you have a skeleton of an algorithm defined in a base class and a small part of the algorithm may vary and is implemented with variation in a subclass, i.e., the concrete class.
In essence, the template of the algorithm is defined in the base class and while certain steps of the algorithm (the part that variesthose that vary from the base class) is are re-defined in a concrete class.To read this article in full or to leave a comment, please click here

Leave a Reply