Guide to Readers 1
1 Introduction 1
1.1 What Is a Design Pattern? 2
1.2 Design Patterns in Smalltalk MVC 4
1.3 Describing Design Patterns 6
1.4 The Catalog of Design Patterns 8
1.5 Organizing the Catalog 9
1.6 How Design Patterns Solve Design Problems 11
1.7 How to Select a Design Pattern 28
1.8 How to Usea Design Pattern 29
2 A Case Study:Designing a Document Editor 33
2.1 Design Problems 33
2.2 Document Structure 35
2.3 Formatting 40
2.4 Embellishing the User Interface 43
2.5 Supporting Multiple Look-and-Feel Standards 47
2.6 Supporting Multiple Window Systems 51
2.7 User Operations 58
2.8 Spelling Checking and Hyphenation 64
2.9 Summary 76
Design Pattern Catalog 79
3 Creational Patterns 81
Abstract Factory 87
Builder 97
Factory Method 107
Prototype 117
Singleton 127
DiscussionofCreational Patterns 135
4 Structural Patterns 137
Adapter 139
Bridge 151
Composite 163
Decorator 175
Facade 185
Flyweight 195
Proxy 207
Discussion of Structural Patterns 219
5 Behavioral Patterns 221
Chain of Responsibility 223
Command 233
Interpreter 243
Iterator 257
Mediator 273
Memento 283
Observer 293
State 305
Strategy 315
Template Method 325
Visitor 331
Discussion of Behavioral Patterns 345
6.1 What to Expect from Design Patterns 351
6 Conclusion 351
6.2 A Brief History 355
6.3 The Pattern Community 356
6.4 An Invitation 358
6.5 A Parting Thought 358
A Glossary 359
B Guide to Notation 363
B.1 Class Diagram 363
B.2 Object Diagram 364
B.3 Interaction Diagram 366
C Foundation Classes 369
C.1 List 369
C.2 Iterator 372
C.3 ListIterator 372
C.4 Point 373
C.5 Rect 374
Bibliography 375
Index 383