Coupling of Design Patterns: Common Practices and Their Beneﬁts
William B. McNatt James M. Bieman
Computer Science Department
Colorado State University
Fort Collins, CO 80525 USA
McNatt: +1-303-971-2271, Bieman: +1-970-491-7096
Abstractroles in both patterns. A change in parts of one pattern can
affect the behavior of the other pattern.
Object-oriented (OO) design patterns deﬁne collections
of interconnected classes that serve a particular purpose. A
design pattern is a structural unit in a system built out of patterns, not unlike the way a function is a structural unit in a
procedural program or a class is a structuralunit in an OO
system designed without patterns. When designers treat patterns as structural units, they become concerned with issues
such as coupling and cohesion at a new level of abstraction.
We examine the notion of pattern coupling to classify how
designs may include coupled patterns. We ﬁnd many examples of coupled patterns; this coupling may be “tight” or
“loose”, and provides both beneﬁtsand costs. We qualitatively assess the goodness of pattern coupling in terms of effects on maintainability, factorability, and reusability when
patterns are coupled in various ways.
Keywords: Design patterns, object-oriented design, design
Design patterns are architectural units, just as classes are
implementation units. We can view a system as acollection
of interacting patterns and independent classes. Pattern instance attributes are potentially measurable in a manner similar to class attributes. Thus, we can examine notions such
as pattern coupling.
Pattern coupling results from connections between patterns. Common classes can connect two patterns. They play
roles in more than one pattern by referencing common objects, and by usingmethods in another pattern. Figure 1
shows a UML class model of two coupled patterns from the
well-known book by Gamma et al . In this example, an
instance of an Abstract Factory pattern is coupled with an
instance of a Visitor pattern through shared classes. Interface ASTNode, classes AST, StmtNode, and DeclNode play
Figure 1. Overlapping patterns: Abstract Factory and Visitor.
Although wehave not found the notion of pattern coupling discussed in the literature, we found numerous examples of coupled patterns. In this paper, we study the 23 patterns described in Gamma et al . The design pattern literature includes many descriptions of actual implementations
that make use of patterns and pattern languages. Published
examples include coupled patterns that are in practical usetoday. Review of the pattern coupling techniques used in
practice can reveal characteristics of this coupling, and help
us understand when and how to couple patterns.
Singleton: “Ensure a class only has one instance, and
provide a global point of access to it.”
We examined the available literature describing speciﬁc
design pattern applications to ﬁnd examples of patterncoupling using the following process:
Adapter: “Convert the interface of a class into another
interface clients expect.”
1. Survey recent literature concerning design pattern applications for examples of interconnected patterns.
Bridge: “Decouple an abstraction from its implementation so that the two can vary independently.”
2. Compile a list of all exampleinstances of Gamma et al
design patterns found in the literature.
Composite: “Compose objects into tree structures to
represent part-whole hierarchies.”
3. Create a sub-list of all groups of patterns used as pairs
or multiple sets of interacting Gamma et al patterns.
Decorator: “Attach additional responsibilities to an
4. Group the list into categories of coupling...