Context:

"inheritance of process": A type family shares a sequential process with one or more stages being type-specific.

Challenge:

To avoid repetition of the entire process in all implementations.

Skill:

Participants:

Processor:

Responsible for outlining a complete generic process, executing part of it, and coordinating the rest.

Concrete Processor:

(for the current purpose:) Implements the missing stages.

Signature:

Processor features the template method (which should not be virtual) as well as one or more "primitives" - virtual (possibly abstract) functions, typically private. Concrete Processor implements the primitives.

Used by:

(Optionally:) Rectangular Inheritance of Association idiom.

Known issues:

  1. The pattern does not apply to constructor and destructor (due to inverted dependency - the state of the Concrete Implementation is undefined at these stages).
  2. The pattern does not apply to recursive processes (e.g. serialization). These cases rather invite explicit supercall (i.e. normal - rather than inverted - control-flow).

Scope:

General.