1 Introduction to Design Patterns
1.1 Tribal Musings
1.2 Art or Science?
1.2.1 Viewing Patterns as Rote
1.2.2 Language-Dependent Views
1.2.3 From Myth to Science
2 Elemental Design Patterns
2.1 Background
2.2 The Where, the Why, the How
2.2.1 Decomposition of Decorator
2.2.2 Down the Rabbit Hole
2.2.3 Context
2.2.4 The Design Space
2.3 Core EDPs
2.4 Conclusion
3 Pattern Instance Notation
3.1 Basics
3.2 The PINbox
3.2.1 Collapsed PINbox
3.2.2 Standard PINbox
3.2.3 Expanded PINbox
3.2.4 Stacked PINboxes and Multiplicity
3.2.5 Peeling and Coalescing
3.3 Conclusion
4 Working with EDPs
4.1 Composition of Patterns
4.1.1 Isotopes
4.2 Recreating Decorator
4.3 Refactoring
4.4 The Big Picture
4.5 Why You May Want to Read the Appendix
4.6 Advanced Topics
4.6.1 Focused Documentation and Training
4.6.2 Metrics
4.6.3 Procedural Analysis
4.7 Conclusion
5 EDP Catalog
Create Object
Retrieve
Inheritance
Abstract Interface
Delegation
Redirection
Conglomeration
Recursion
Revert Method
Extend Method
Delegated Conglomeration
Redirected Recursion
Trusted Delegation
Trusted Redirection
Deputized Delegation
Deputized Redirection
6 Intermediate Pattern Compositions
Fulfill Method
Retrieve New
xiii
Contents ix
Retrieve Shared
Objectifier
Object Recursion
7 Gang of Four Pattern Compositions
7.1 Creational Patterns
7.1.1 Abstract Factory
7.1.2 Factory Method
7.2 Structural Patterns
7.2.1 Decorator
7.2.2 Proxy
7.3 Behavioral Patterns
7.3.1 Chain of Responsibility
7.3.2 Template Method
7.4 Conclusion
A ρ-Calculus
A.1 Reliance Operators
A.2 Transitivity and Isotopes
A.3 Similarity
A.4 EDP Formalisms
A.5 Composition and Reduction Rules
A.6 Pattern Instance Notation and Roles
A.7 EDP Definitions
A.7.1 Create Object
A.7.2 Retrieve
A.7.3 Inheritance
A.7.4 Abstract Interface
A.7.5 Delegation
A.7.6 Redirection
A.7.7 Conglomeration
A.7.8 Recursion
A.7.9 Revert Method
A.7.10 Extend Method
A.7.11 Delegated Conglomeration
A.7.12 Redirected Recursion
A.7.13 Trusted Delegation
A.7.14 Trusted Redirection
A.7.15 Deputized Delegation
A.7.16 Deputized Redirection
xiv
x Contents
A.8 Intermediate Pattern Definitions
A.8.1 Fulfill Method
A.8.2 Retrieve New
A.8.3 Retrieve Shared
A.8.4 Objectifier
A.8.5 Object Recursion
A.9 Gang of Four Pattern Definitions
A.9.1 Abstract Factory
A.9.2 Factory Method
A.9.3 Decorator
A.9.4 Proxy
A.9.5 Chain of Responsibility
A.9.6 Template Method
Bibliography
Index
Figures
2.1 Decorator's usual example UML
2.2 Objectifier as UML
2.3 Object Recursion as UML
2.4 A simple method call as UML
2.5 The parts of a method call
2.6 A simple design space
2.7 A simple design space with EDPs
2.8 Our first four EDPs
2.9 The design space extended to three dimensions
2.10 The design space with method similarity fixed to similar
2.11 Recursion Example UML
2.12 Deputized Redirection example UML
3.1 UML collaboration diagram
3.2 Strategy as pattern:role tags in UML
3.3 Huge UML of a not-so-huge system
3.4 Multiple instances of Strategy as pattern:role tags in UML
3.5 Collapsed PIN