The 'Gang of Four' Companion:

Print this document

Decorator Design Pattern

Formal specification of design patterns in LePUS3 and Class-Z

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 Decorator design motif

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

Intent: Attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality.

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

Decorator in UML

Participants:

Collaborations: Decorator forwards requests to its Component object. It may optionally perform additional operations before and after forwarding the request.

Formal specification

See also:

Decorator in LePUS3
Decorator in LePUS3 (legend)
Decorator in Class-Z (legend)