- Copyright 2002
- Edition: 1st
-
Book
- ISBN-10: 0-201-65759-7
- ISBN-13: 978-0-201-65759-3
Take the struggle out of learning about design patterns! Through example-based teaching, The Joy of Patterns reveals the essence of design patterns as an advanced language for describing system design. This book illustrates how to build more efficient, robust, and reusable designs with this powerful programming paradigm.
Design patterns have been used as integral techniques for creating better software, but getting started with design patterns has never been easy. Beginning with a description of the rationale behind design patterns, the discussion moves on to an overview of the basic pattern form, and then to a brief review of object-oriented concepts. Following this crucial background, the author presents a series of system design examples from initial conception all the way through code, discussing key design goals and the pros and cons of using various design patterns. Code is presented in Java, C++, and Visual Basic. The reader will gain insight into the inherent forces at work in the application design and the most effective application of numerous core design patterns as solutions to recurring programming problems.
You will read and learn about such important ideas and topics as:
- Patterns as the language of design and the building blocks of architecture
- The value and use of many standard patterns in system design
- Extensible software development and change management
- Utilizing supporting patterns to prevent loose ends
- Testing and deploying new behaviors
- Understanding requirements and creating hinge points for entities that are likely to change
The Joy of Patterns examines the relationship between specific programming languages and language-independent design patterns. It also looks at the role of patterns in building systems from scratch through system maintenance and product evolution.
With the background and deeper understanding harnessed from this book, you will have the ability to unleash the considerable power of design patterns and enhance the quality of your programming efforts.
0201657597B09072001
Downloadable Sample Chapter
Click below for Sample Chapter related to this title:
goldfedderch01.pdf
Table of Contents
Preface.
Acknowledgements.
What's it all about?
1. Initial Thoughts: A Personal Note.
Background.
Summary.
2. An Introduction To Patterns
The Building Blocks of Architecture.
Pattern Form.
Patterns. The Language of Design.
Documentation.
Extensible Software Development and Change Management.
Training.
Silver Bullets.
Summary.
3. OO at a Glance
Introduction.
Inheritance.
Components.
Summary
4. A Product Configurator.
Introduction.
Problem Definition.
Solution.
Observations.
Composite.
Summary.
5. BurgerShop.
Overview.
Sue's Burger Shop.
Reflections.
Simplifications.
Summary
6. Programming Languages and Patterns,
Java Observer.
Summary
7. Patterns and System Development,
Building from scratch.
Understanding Your Requirements.
Create Hinge Points for the Unknowns and Entities that We Suspect likely to change.
Utilize supporting patterns to ensure no loose ends.
Make a Sanity Check.
Implement a Little.
Restart the Whole Process at a Lower Level as Necessary.
Summary.
8. Patterns and System Evolution (Maintenance).
Maintenance.
A Quick Example.
Strategy.
Summary.
9. Closing Thoughts.
10. Appendix A. Product Code.
11. Appendix B. BurgerShop Code.
13. Appendix C. Blackjack Code.
References
Index.
Preface
PrefaceWhat's it all about?
This book is about the practice of correctly applying patterns to build software systems. It is intended to complement the outstanding body of patterns available by educating the reader on the general concepts of proper use that hold true regardless of the specific pattern or system. Far too often developers and managers who first attempt to use patterns fail to do so properly because they completely miss the intent and simple concepts involved; instead, they tend to focus on patterns as coding tricks rather than as a higher-level language for describing system design. This book attempts to fix this problem by providing the reader the tools necessary to ensure success.
In the first basic software design course I ever taught, we struggled over how someone could actually "teach" design. What we determined to be the best approach was to present the trade-offs and heuristics through the use of examples and to allow the participants to learn in this manner. I still believe this is a fundamental way to teach design and have tried to carry it forward in my training classes, in my consulting, and also in this book.
The approach I have taken in this book is to provide this insight through a series of system designs from initial conception through code. I recognized early in instructing this type of material that, while design has little to do with code, it is still essential to show the resulting programming language code that is the real end product of system development. I provide many examples to illustrate the use of patterns to build systems that will be implemented in one of three currently popular programming languages: Visual Basic, C++, and Java. While I do dive into the depth of the code to illustrate key points, I have tried not to require a lot of programming or other formal training for the reader.
In order to focus on using patterns rather than on trying to survey the depth of patterns now available, I primarily focus on a core subset of patterns in this book, primarily those originally captured in the now classic Design Patterns Gam, 95. I will augment this essential set with a few unique patterns of my own and of other authors where appropriate.
This book is intended to be read in the order it is presented, although readers may feel free to skip around as they need to. However, I would still suggest reading Chapter 2, "An Introduction to Patterns" before reading other sections. The general approach used in this book is first to introduce the readers to patterns and a subset of object-oriented concepts and notations so that we are all on the same page. I then quickly move into the examples to show the application of patterns to address different problems and show the pros and cons that result as guiding decisions in the system architecture are made.
When I teach patterns, there is usually a point at the beginning of the courses when people simply do not get the mental shift required to look at software development in a new manner. As an instructor I can tell by the glazed look in the students' eyes (although that is often due to the morning caffeine not yet setting in). Suddenly about a third of the way through the material, students start to pull the pieces together and realize that patterns are simply more than coding tricks or language techniques. This paradigm shift seems suddenly to come to the students, and they quickly grasp the importance of these techniques on their entire approach to software development.
My hope is that you, the reader of this material, will think about the material and the examples and gain this same enlightenment. This will occur quickly once we can recognize that there are inherent forces at work in software design, and we can approach the problem from a more esthetic nature, rather than simply as a coding technique. You will begin to look at patterns as a key tool in design and be able to use patterns properly; equally important, you will know how and when not to use them. The ability to look at a problem in terms of the forces at work and the context will greatly improve all subsequent efforts. At this point our goals will have succeeded.
I hope you enjoy the journey.
0201657597P09072001
Index
A
- Abstract Data Types (ADT), 31-34
- Abstract Factory, 99
- Abstraction
- Abstract Class, 36, 38
- Abstract Strategy patterns, 103
- variations and, 94
- Account example, 78-84
- ACM, 28
- Ada 83, 17
- Adapter, 99
- ADT (Abstract Data Types), 31-34
- Advanced C++: Programming Style and Idioms, 28
- Alexander, Christopher, 2, 28
- Aliases, 4, 9
- Analysis Patterns: Reusable Object Models, 28
- Architecture
- building blocks of, 7-8
- flexibility, 92
- Pattern-Oriented software, 28-29
- present v. future needs, 3-4
- system variance and, 91-92
B
- Background, 1-2
- Base Class, 50
- BEA Jolt, 42
- Beck, Kent, 5, 13, 28
- Berczuk, Steve, 2n
- Binary search, 23
- Blackjack example
- architecture flexibility, 92
- codes overall, 143-166
- creating hinge points, 87-91
- language choices, 92-94
- restarting at lower levels, 94-95
- understanding requirements, 86-87
- using supporting patterns, 91-92
- Booch, Grady, 28, 43
- Bridge, 14, 15, 22, 99
- Build for Today, Design for Tomorrow, 2n, 4
- Builder, 54-59, 99, 120-121
- BurgerShop example
- codes, 125-141
- getPrice, 66-71
- modeling, 61-71
- overview, 61
- reflections, 72-73
- simplifications, 73-75
- summary, 75
- templates, 140-141
- Buschmann, Frank, 28
C
- C+, 36
- C++
- building flexibility, 3
- BurgerShop example, 71
- checking, 92
- interfaces, 36
- object-orientation, 17
- passing parameters, 18-19
- pattern compatibility, 77-78
- Standard Library, 18
- C languages, 77, 78
- Chain of Responsibility, 55, 99
- Change management, 23-27
- Class
- Abstract, 36, 38
- base, 50
- Class explosion, 61-75
- CompositePart, 50
- Concrete, 36, 38, 50, 91
- implementing interfaces, 33-34, 35
- middle, 89
- Coad, Peter, 28
- COBOL, 17, 36, 78
- Codes
- Blackjack. See Blackjack example
- BurgerShop. See BurgerShop example
- Product. See> Product codes
- Colors, 24, 26-27
- Command, 99
- Commonality, 88
- Communication skills, 20-22
- Components, 41-42
- Composite
- patterns, 48-55, 75
- varies, 99
- Concrete Class, 36, 38, 92
- Concrete Strategy patterns, 103
- Configuration. See also Product Configuration example
- defined, 48
- resources, 51-54
-
Context
- building or extending systems, 2
- defined, 12-13
- feature use and removal, 14
- phasing out features, 16
- Recyle Bin, 14
- resource allocation, 14
- selecting state, 26
- Coplien, Jim, 28, 88
- CORBA, 41-42
- Creational patterns, 91-92, 100
- Cunningham, Ward, 28
D
- Data elements, 38
- Decorator
- BurgerShop example, 66-75
- Class explosion, 63-66
- logging mechanisms, 95
- tracing logging capability example, 50
- varies, 99
- Delegation, 39, 41
- Design Patterns: Elements of Reusable Object-Oriented Software, 28
- Design Rationale, 13, 14, 17
- Development. See System development
- Displayers, 91, 94, 96
- Documentation, 22-23, 98
- Domain-specific concepts, 17
- Drivers, 56, 118-119, 121-124
E
- ECOOP 93, 28
- EJB (Enterprise Java Beans), 41
- Elegance, 97
- Encapsulation, 31, 38-39
- Enterprise Java Beans (EJB), 41
- Enumerator, 59
- ErrorHandlers, 103-104
- Evolution of systems. See Maintenance
- Extensible software development, 23-27
- Extreme Programming, 4-5
- Extreme Programming Explained: Embrace (XP), 4
F
- Facade, 99
- Factory Method, 92, 99
- Flyweight patterns, 25, 99, 104, 134n
- Force Resolution, 13
- Forces
- defined, 10-12
- High Road Development example, 2-3
- importance of features to users, 16
- Recyle Bin, 14
- Form, 9-13
- FORTRAN, 17-18
- Fowler, Martin, 28, 43, 100
- Future v. present needs, 2-5
G
- Gamma, Erich, 28
- Generalization, 34
- GOF patterns, 98, 99
- Goldfedder, Brandon
- e-mail address, 110
- Recycle Bin pattern, 15
- Scream Test pattern, 17
H
- Helm, Richard, 28
- Help desks, 17
- Hewlett-Packard Company, 157-158
- High Road Development, 2-5, 87
- Hillside Group, 28
- Hinge points, 87-91, 98-100
- History
- author's background, 1-2
- of patterns, 28
- of programming languages, 17-18
- Hotspot, 15
I
- Implementation
- interfaces, 33-35, 36
- languages, 18-19
- present v. future needs, 3-4
- system development, 92-94
- Inheritance, 34-41, 61-63, 94
- Interfaces, 33-34, 35, 36
- Interpreter, 99
- Iterator, 59, 99
J
- Java
- Account example, 82-84
- common libraries, 18
- components, 42
- CompositePart.java, 114-115
- Hotspot Java, 15
- interfaces, 36
- Java Application Servers, 42
- Observer, 82-84
- pattern compatibility, 77
- Product Configuration System, 59
- Johnson, Ralph, 28
- Jolt, 42
- Just In Time, 4
K
- Kernel requests, 14
- Knowledge transfer, 27
L
- Leaf nodes, 49
- LEGO sets, 7
- Libraries
- reuse, 17-18, 23
- shared, 41
- thread, 77
- Liskov, B., 36
M
- Maintenance
- adding new patterns, 100
- adding or changing behaviors, 99-100
- ErrorHandlers, 103-104
- evolution, 97
- example, 101
- MsgBoxes, 104
- overview, 97-98
- refactoring, 100, 106-108
- SNMP alerts, 104
- standard design and coding, 100
- Strategy patterns, 101-106
- summary, 106-108
- testing and deployment, 100-101
- understanding change and its impact, 98-99
- Mediator, 99
- Memento, 99
- Memory, 14-15
- Meyers, Scott, 24, 38
- Microsoft, 41, 78
- Middle Class, 89
- Modules, 31
- MsgBoxes, 104
- Multi-Paradigm Design for C++, 88
N
- Names, 9
- Notes on the Synthesis of Form, 28
- Null Object, 134n
- Null pattern, 134n
O
- Object-Based Design, 32
- Object-Orientation. See OO
- Object-Oriented Design (OOD), 31
- Observer, 8-9, 79-84, 99
- OMG, 41
- OO, 31-42
- change management, 23
- components, 41-42
- inheritance, 34-40
- introduction, 31-34
- summary, 42-43
- OOD techniques, 31
- Opdyke, William, 100
- Open-Closed Principle, 24, 46, 98
P
- Palm Pilot, 1
- Parameterization, 36
- Parnas, David, 31
- PartList, 102
- Parts
- building, 54-59
- defined, 47, 50
- hierarchy, 51, 54
- Pattern Language, A, 28
- Pattern Language of Programming (PLoP) Conference, 28
- Pattern-Oriented Software Architecture: A System of Patterns, 28
- Patterns
- Account example, 78-84
- architecture, 7-8
- Builder, 54-59
- Composite, 48-55
- Creational, 91-92, 100
- Decorator, 50, 95
- defined, 7
- documentation, 22-23
- extensible software development, 23-27
- Factory Method, 92
- Flyweight, 25, 104, 134n
- form, 9-13
- GOF, 98, 99
- High Road Development, 2-5
- history of, 28
- independence from programming languages, 77-84
- Null, 134n
- Observer, 8-9, 79-84
- present v. future needs, 2-5
- programming languages, 17-22, 77-84
- proxy, 9
- Recycle Bin, 13-16
- refactoring, 100
- Scream Test, 16-17
- State, 25-27, 50, 101, 104
- Strategy, 75, 89, 101-106
- summary, 109-110
- system development, 85-95
- system maintenance, 97-108
- PL-SQL, 78
- PLoP 3, 134n
- PLoP (Pattern Language of Programming) Conference, 28
- Present v. future needs, 2-5
- Pricing, 66-71, 75, 101, 104-106
- Problem
- creating sales support system, 45-47
- defined, 9-10
- determining if system aspects are in use, 16
- existing v. future requirements, 17-18
- Product Configuration example
- builder pattern, 55-59
- composite, 49-55
- introduction, 45
- observations, 48
- problem definition, 45-47
- solution, 47-48
- system maintenance, 101
- Programming languages. See also by individual languages
- interfaces, 36
- OO. See OO
- pattern independence and compatibility, 77-84
- patterns as language of design, 17-22
- UML (Unified Modeling Language), 31-34, 43
- Prototype, 99
- Proxy, 9, 99
- Publisher Subscriber, 8-9
- Push v. Pull models, 9
R
- RAD, 4
- Radio Shack, 1
- Recycle Bin, 13-16
- Refactoring, 4-5, 100, 106-108
- Refactoring: Improving the Design of Existing Code, 28
- Reification, 24
- Requirements, 86-87
- Resources
- configuration, 51-54
- creation and destruction of, 13-16
- defined, 48
- Resulting Context
- defined, 13
- existing v. future requirements, 3
- Recyle Bin, 14
- understanding importance of features, 16
- Reuse library, 17-18, 23
- Review process, 35
- Rising, Linda, 28
S
- Scream Test, 16-17
- Silver Bullets, 28
- SimplePart, 50, 58-59, 102, 105
- SimplePart.java, 113
- Singleton, 25, 99, 134n
- SmallTalk, 17, 28, 100
- SNMP alerts, 104
- Solutions
- creating sales support system, 47-48
- defined, 13
- design v. implementation, 3
- Recyle Bin, 14
- temporary disabling of features, 16
- State patterns
- behavior and internal state change, 24, 25-27
- pricing calculations, 101, 104
- Product Configuration, 50
- varies, 99
- Strategy patterns, 89, 101-106
- Abstract, 103
- Concrete, 103
- decorator use, 75
- varies, 99
- Structure, 13
- Substitution Principle, 36
- Switch scheduling systems, 21
- System development
- building from scratch, 85-86
- coding, 92-94
- hinge points for change, 87-91
- implementation, 92-94
- restarting at lower levels, 94-95
- sanity checks, 92
- summary, 95
- supporting patterns, 91-92
- understanding requirements, 86-87
- System Maintenance. See Maintenance
T
- Taligent, Inc., 23
- Team-based approaches, 21-22
- Template Method, 99, 140-141
- Templates, 140-141
- The Pattern Almanac, 28
- Thread libraries, 77
- Total Commissions Systems (TCS), 4
- Training, 27
- Transact-SQL, 78
- Transaction Monitors, 41-42
- Type (interface), 33-35
U
- UML Distilled, 43
- UML (Unified Modeling Language), 31, 33-34, 43
- UML Users Guide, 43
- UNIX systems, 14, 21
- Unknowns, 12, 86-87
V
- Variance, 88-91, 99
- Varies
- defined, 13
- GOF patterns, 99
- object structure and composition, 49
- Observer patterns, 8
- State pattern, 25
- Visitor, 99
- Visual Basic
- Account example, 78-82
- pattern compatibility, 77-78
- single-inheritance, 94
- Vlissides, John, 28
W
- Woolf, Bobby, 134n