This article describes the Template Method design pattern. This is a behavioral design pattern, a category of design pattern used by software engineers, when writing computer programs.

Table of Contents

Introduction

The Template Method pattern is a design pattern, used in software engineering to define the general structure of an object. For example a class is created with just a set of abstract methods and properties, which define the general theme and use of the class. later, concrete classes are implemented which change the abstract methods into actual operations.


It is defined as a behavioral design pattern, because it is the definition of the methods that a class will use to perform it's actions.

Return to Top


Benefits

It allows a class to control or expose parts of it's behavior, which allows greater extensibility.
It allows a developer to expose suggested "forward thinking" for the class as well as immediate usefulness.

Return to Top


Examples of the pattern

In C# & VB.net, overriding methods is an example of the Template Method.

 

 

Return to Top


See Also

Link to domain parent articles and related articles in TechNet Wiki.

 

Return to Top


Community Resources

These are the external links, including links to Microsoft and TechNet sites that are non-Wiki

 

Return to Top


References section

Use this section if you pulled source material and ideas from other sites, blogs, or forums. Make sure you have permission from authors to use their material.

 

 

Return to Top