Professional Documents
Culture Documents
Patterns in Java ,
Volume 1
A Catalog of Reusable
Design Patterns
Illustrated with UML
Second Edition
MARK GRAND
Patterns in Java , Volume 1
Second Edition
9525_Grand_fm_v.qxd 8/26/02 9:23 AM Page ii
9525_Grand_fm_v.qxd 8/26/02 9:23 AM Page iii
Patterns in Java ,
Volume 1
A Catalog of Reusable
Design Patterns
Illustrated with UML
Second Edition
MARK GRAND
This book is printed on acid-free paper.
Wiley also publishes its books in a variety of electronic formats. Some content that
appears in print may not be available in electronic versions.
For more information about Wiley products, visit our web site at www.wiley.com.
10 9 8 7 6 5 4 3 2 1
9525_Grand_fm_v.qxd 8/26/02 9:23 AM Page v
C O N T E N T S
Acknowledgments ix
v
9525_Grand_fm_v.qxd 8/26/02 9:23 AM Page vi
vi Contents
Contents vii
Chapter 8 Behavioral Patterns 303
Chain of Responsibility 305
Command 317
Little Language 329
Mediator 355
Snapshot 369
Observer 387
State 397
Null Object 407
Strategy 413
Template Method 419
Visitor 427
Bibliography 567
Index 569
9525_Grand_fm_v.qxd 8/26/02 9:23 AM Page viii
9525_Grand_fm_v.qxd 8/26/02 9:23 AM Page ix
A C K N O W L E D G M E N T S
ix
9525_Grand_fm_v.qxd 8/26/02 9:23 AM Page x
x Acknowledgments
A B O U T T H E A U T H O R
C H A P T E R 1
Introduction to
Software Patterns