Technical Publications


Contact Information

Patterns for Encapsulating Class Trees

Riehle D.


Good object-oriented design firmly relies on abstract classes. They define the interface to work with subclasses that implement them. If clients directly name these subclasses, they become dependent on them. This complicates both system configuration and evolution. The patterns of Late Creation and Class Retrieval presented in this paper overcome these problems by encapsulating class trees behind their root classes. Clients use class specifications to retrieve classes and create objects. Classes can be removed and plugged into the class tree more easily. Thus, encapsulating class trees eases system evolution and configuration of system variants.

The patterns of this paper are presented using a new variation of the pattern form. We start by outlining the overall background on which the patterns emerge. This background explains what the patterns are relevant for and what they achieve. It is the overall pattern context and the recursive closure of all subsequent pattern contexts.

After introducing the background, we present each pattern in a subsection of its own. A subsection mainly consists of a pattern/context pair that separates the actual pattern from the embedding context. This is based on our understanding of a pattern as a form emerging in specific contexts. The form is finite and can be described precisely, while the context is infinite and can only be partially described (that is, we extract what we think is relevant to understand the forces driving the pattern).

Section 2 introduces the background of the presented patterns. Section 3 and 4 present the patterns needed for encapsulating class trees. Section 5 compares the patterns with other patterns, most notably Factory Method and Abstract Factory. Section 6 goes back to discuss the pattern form and what we have gained from using it. Section 7 summarizes the paper and presents some further conclusions.

[Rie96a] Riehle D.. Patterns for Encapsulating Class Trees. In Pattern Languages of Program Design 2, chapter 6, pages 87-104, Addison-Wesley, Reading MA, 1996.

Get publication ( 70K, Adobe Acrobat PDF ).
Get publication ( 47K, PostScript ).

Questions, comments, suggestions?
This site is generously hosted by Macrofocus GmbH, developer of TreeMap, High-D, and other fine visualization tools
Page rendered on Thursday, February 03, 2000