This third volume from Mark Grand features 38 design patterns for developing real-world Java distributed and enterprise applications. Some of the key concepts covered are reliable transaction processing, distributed objects, reliable message passing, concurrency management, object persistence, and c
Design patterns in Java = Java 设计模式
✍ Scribed by Metsker, Steven John;Wake, William C
- Publisher
- Addison-Wesley Professional; Posts & Telecom Press
- Year
- 2006;2007
- Tongue
- English
- Leaves
- 478
- Series
- Software Patterns Series
- Edition
- 2nd Edition
- Category
- Library
No coin nor oath required. For personal study only.
✦ Synopsis
Design Patterns in Java(TM)gives you the hands-on practice and deep insight you need to fully leverage the significant power of design patterns in any Java software project. The perfect complement to the classicDesign Patterns, this learn-by-doing workbook applies the latest Java features and best practices to all of the original 23 patterns identified in that groundbreaking text.
Drawing on their extensive experience as Java instructors and programmers, Steve Metsker and Bill Wake illuminate each pattern with real Java programs, clear UML diagrams, and compelling exercises. You'll move quickly from theory to application--learning how to improve new code and refactor existing code for simplicity, manageability, and performance.
Coverage includes
Using Adapter to provide consistent interfaces to clients
Using Facade to simplify the use of reusable toolkits
Understanding the role of Bridge in Java database connectivity
The Observer pattern, Model-View-Controller, and GUI behavior
Java Remote Method Invocation (RMI) and the Proxy pattern
Streamlining designs using the Chain of Responsibility pattern
Using patterns to go beyond Java's built-in constructor features
Implementing Undo capabilities with Memento
Using the State pattern to manage state more cleanly and simply
Optimizing existing codebases with extension patterns
Providing thread-safe iteration with the Iterator pattern
Using Visitor to define new operations without changing hierarchy classes If you're a Java programmer wanting to save time while writing better code, this book's techniques, tips, and clear explanations and examples will help you harness the power of patterns to improve every program you write, design, or maintain.
All source code is available for download at http: //www.oozinoz.com.
✦ Table of Contents
Cover......Page 1
Contents......Page 8
Preface......Page 14
Why Patterns?......Page 16
Why Design Patterns?......Page 17
Why Java?......Page 18
Challenges......Page 19
The Organization of This Book......Page 20
Welcome to Oozinoz!......Page 21
Summary......Page 22
PART I: INTERFACE PATTERNS......Page 24
Interfaces and Abstract Classes......Page 26
Interfaces and Obligations......Page 28
Summary......Page 30
Beyond Ordinary Interfaces......Page 31
Adapting to an Interface......Page 32
Class and Object Adapters......Page 36
Adapting Data for a JTable......Page 40
Identifying Adapters......Page 45
Summary......Page 46
Facades, Utilities, and Demos......Page 48
Refactoring to FACADE......Page 50
Summary......Page 61
An Ordinary Composite......Page 62
Recursive Behavior in Composites......Page 63
Composites, Trees, and Cycles......Page 65
Composites with Cycles......Page 71
Summary......Page 75
An Ordinary Abstraction: On the Way to BRIDGE......Page 78
From Abstraction to BRIDGE......Page 81
Drivers as BRIDGES......Page 83
Database Drivers......Page 84
Summary......Page 86
PART II: RESPONSIBILITY PATTERNS......Page 88
Ordinary Responsibility......Page 90
Controlling Responsibility with Visibility......Page 92
Beyond Ordinary Responsibility......Page 94
SINGLETON Mechanics......Page 96
Singletons and Threads......Page 98
Recognizing SINGLETON......Page 99
Summary......Page 101
A Classic Example: OBSERVER in GUIs......Page 102
Model/View/Controller......Page 107
Maintaining an Observable Object......Page 114
Summary......Page 116
A Classic Example: GUI Mediators......Page 118
Mediators of Relational Integrity......Page 123
Summary......Page 131
A Classic Example: Image Proxies......Page 132
Image Proxies Reconsidered......Page 137
Remote Proxies......Page 140
Dynamic Proxies......Page 146
Summary......Page 151
An Ordinary Chain of Responsibility......Page 152
Refactoring to CHAIN OF RESPONSIBILITY......Page 154
Anchoring a Chain......Page 157
Summary......Page 159
Immutability......Page 160
Extracting the Immutable Part of a Flyweight......Page 161
Sharing Flyweights......Page 163
Summary......Page 167
PART III: CONSTRUCTION PATTERNS......Page 168
A Few Construction Challenges......Page 170
Beyond Ordinary Construction......Page 172
An Ordinary Builder......Page 174
Building under Constraints......Page 177
A Forgiving Builder......Page 179
Summary......Page 180
A Classic Example: Iterators......Page 182
Recognizing FACTORY METHOD......Page 183
Taking Control of Which Class to Instantiate......Page 184
FACTORY METHOD in Parallel Hierarchies......Page 186
Summary......Page 188
A Classic Example: GUI Kits......Page 190
Abstract Factories and Factory Method......Page 195
Packages and Abstract Factories......Page 199
Summary......Page 200
Prototypes as Factories......Page 202
Prototyping with Clones......Page 204
Summary......Page 207
A Classic Example: Using Memento for Undo......Page 208
Persisting Mementos Across Sessions......Page 216
Summary......Page 220
PART IV: OPERATION PATTERNS......Page 222
Operations and Methods......Page 224
Signatures......Page 226
Exceptions......Page 227
Algorithms and Polymorphism......Page 228
Summary......Page 229
Beyond Ordinary Operations......Page 230
A Classic Example: Sorting......Page 232
Completing an Algorithm......Page 236
TEMPLATE METHOD Hooks......Page 239
Refactoring to TEMPLATE METHOD......Page 240
Summary......Page 243
Modeling States......Page 244
Refactoring to STATE......Page 248
Making States Constant......Page 253
Summary......Page 255
Modeling Strategies......Page 256
Refactoring to STRATEGY......Page 259
Comparing STRATEGY and STATE......Page 263
Comparing STRATEGY and TEMPLATE Method......Page 264
Summary......Page 265
A Classic Example: Menu Commands......Page 266
Using COMMAND to Supply a Service......Page 269
COMMAND Hooks......Page 270
COMMAND in Relation to Other Patterns......Page 272
Summary......Page 274
An INTERPRETER Example......Page 276
Interpreters, Languages, and Parsers......Page 289
Summary......Page 290
PART V: EXTENSION PATTERNS......Page 292
Principles of Object-Oriented Design......Page 294
The Liskov Substitution Principle......Page 295
The Law of Demeter......Page 296
Beyond Ordinary Extensions......Page 298
Summary......Page 300
A Classic Example: Streams and Writers......Page 302
Function Wrappers......Page 310
Summary......Page 318
Ordinary Iteration......Page 320
Thread-Safe Iteration......Page 322
Iterating over a Composite......Page 328
Summary......Page 339
VISITOR Mechanics......Page 340
An Ordinary VISITOR......Page 342
VISITOR Cycles......Page 348
VISITOR Risks......Page 353
Summary......Page 355
PART VI: APPENDIXES......Page 356
Get the Most from This Book......Page 358
Weave Patterns into Your Code......Page 359
Keep Learning......Page 360
APPENDIX B: SOLUTIONS......Page 362
Building the Oozinoz Code......Page 442
Finding Files Yourself......Page 443
Summary......Page 444
APPENDIX D: UML AT A GLANCE......Page 446
Classes......Page 447
Class Relationships......Page 448
Interfaces......Page 450
Objects......Page 451
States......Page 452
C......Page 454
E......Page 455
I......Page 456
M......Page 457
P......Page 458
S......Page 459
X......Page 460
Bibliography......Page 462
A......Page 464
C......Page 465
D......Page 467
G......Page 468
I......Page 469
M......Page 470
O......Page 471
P......Page 472
R......Page 473
S......Page 474
T......Page 475
X......Page 476
✦ Subjects
Computer Science;Programming;Science;Technology;Technical;Software;Reference
📜 SIMILAR VOLUMES
A how-to guide for Java programmers who want to use design patterns when developing real-world enterprise applications This practical book explores the subject of design patterns, or patterns that occur in the design phase of a project's life cycle. With an emphasis on Java for the enterprise, M
Java design patterns with the Simplest real world examples which are easy to understand & remember as well.<br>Table of Contents<br> PREFACE<br>ABOUT DESIGN PATTERNS<br>SINGLETON PATTERN<br>FACTORY PATTERN<br>ABSTRACT FACTORY PATTERN<br>BUILDER PATTERN<br>PROTOTYPE PATTERN<br>ADAPTER PATTERN<br>COMP
设计模式是构建大型软件系统最强大的方法之一,优化软件架构和设计已经逐渐成为软件开发和维护过程中的一个重要课题。 本书通过11章内容,全面揭示有关设计模式的内容,并结合Python语言进行示例化的解析。全书囊括单例设计模式、工厂模式、门面模式、代理模式、观察者模式、命令模式、模板方法模式、复合模式、状态设计模式以及反模式等多种设计模式。 本书适合那些关注软件设计原则,并想将优秀的设计模式应用到Python编程当中的读者阅读,也适合普通的软件工程师、架构师参考。