The 'Gang of Four' Companion:

Template Method Design Pattern

Formal specification of design patterns in LePUS3 and Class-Z

Print this document

This page is part of the The 'Gang of Four' Companion dedicated to the formal specification in LePUS3 and Class-Z of patterns from the 'Gang of Four' catalogue [Gamma et al 1995].

Links

Download:

The Template Method design motif

The informal description: Excerpts from [Gamma et al. 1995] (adapted for this purpose):

Intent: Define the skeleton of an algorithm in an operation, deferring some steps to subclasses. Template Method lets subclasses redefine certain steps of an algorithm without changing the algorithm's structure.

Structure: Original OMT diagram converted to UML (Why and How?):

Template Method in UML

Participants:

Collaborations: ConcreteClass relies on AbstractClass to implement the invariant steps of the algorithm.

Formal specification

See also:

Template Method in LePUS3
Template Method in LePUS3 (legend)
Template Method in Class-Z (legend)