Patterns for Encapsulating Class Trees

By: D. Riehle
Published in: PLoPD2
Pages: 87-104
Category: Creational, Structural

Summary: Encapsulation of class hierarchies behind their root classes.


Pattern: Class Retrieval

Pages: 92-94

Clients of an encapsulated class tree need to retrieve classes from that tree. Have the clients create a specification for classes they are interested in. The client requests all classes from the class tree that meet the specification.

Category: Structural

Pattern: Late Creation

Pages: 94-95

An encapsulated class tree is of no use unless objects of its internal classes can be created. Clients only know the interface class and a property that unambiguously identifies the class they are interested in. The client of a class creates a specification that unambiguously identifies a single class, then requests a new instance of a class that fits the specification.

Category: Creational

Pattern: Class Clause

Pages: 95-98

A class clause makes an atomic statement about a class property that is true or false. It is represented by an object and can be compared to other clauses. It provides a basis for class specifications and first-class representations of class semantics.

Category: Structural

Pattern: Class Specification

Pages: 98-99

Clients use specifications to retrieve classes from a class tree. A class specification is a formula from propositional calculus with clauses as its basic constituents. Clients build a specification by creating clauses and using them in a formula.

Category: Structural

Pattern: Class Semantics

Pages: 99-101

Provide a set of clause instances for each class. Each clause makes a statement about the class. The set of clauses represents the semantics of the class. A class can be matched against a specification, which is realized by comparing clauses and evaluating the formula.

Category: Structural