Thư viện tri thức trực tuyến
Kho tài liệu với 50,000+ tài liệu học thuật
© 2023 Siêu thị PDF - Kho tài liệu học thuật hàng đầu Việt Nam

Pattern-Oriented Software Architecture For Dummies®
Nội dung xem thử
Mô tả chi tiết
www.it-ebooks.info
www.it-ebooks.info
Pattern-Oriented
Software
Architecture
FOR
DUMmIES‰
www.it-ebooks.info
www.it-ebooks.info
by Robert Hanmer
A John Wiley and Sons, Ltd, Publication
Pattern-Oriented
Software
Architecture
FOR
DUMmIES‰
www.it-ebooks.info
Pattern-Oriented Software Architecture For Dummies®
Published by
John Wiley & Sons, Ltd.
The Atrium
Southern Gate
Chichester
West Sussex
PO19 8SQ
England
Email (for orders and customer service enquires): [email protected]
Visit our home page on www.wiley.com
Copyright © 2013 by Alcatel-Lucent. All rights reserved.
Published by John Wiley & Sons Ltd, Chichester, West Sussex
All rights reserved. No part of this publication may be reproduced, stored in a retrieval system or transmitted
in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise,
except under the terms of the Copyright, Designs and Patents Act 1988 or under the terms of a licence
issued by the Copyright Licensing Agency Ltd., Saffron House, 6-10 Kirby Street, London EC1N 8TS, UK,
without the permission in writing of the Publisher. Requests to the Publisher for permission should be
addressed to the Permissions Department, John Wiley & Sons, Ltd, The Atrium, Southern Gate, Chichester,
West Sussex, PO19 8SQ, England, or emailed to [email protected], or faxed to (44) 1243 770620.
LIMIT OF LIABILITY/DISCLAIMER OF WARRANTY: THE PUBLISHER, THE AUTHOR, AND ANYONE ELSE
IN PREPARING THIS WORK MAKE NO REPRESENTATIONS OR WARRANTIES WITH RESPECT TO THE
ACCURACY OR COMPLETENESS OF THE CONTENTS OF THIS WORK AND SPECIFICALLY DISCLAIM
ALL WARRANTIES, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
PURPOSE. NO WARRANTY MAY BE CREATED OR EXTENDED BY SALES OR PROMOTIONAL
MATERIALS. THE ADVICE AND STRATEGIES CONTAINED HEREIN MAY NOT BE SUITABLE FOR
EVERY SITUATION. THIS WORK IS SOLD WITH THE UNDERSTANDING THAT THE PUBLISHER IS
NOT ENGAGED IN RENDERING LEGAL, ACCOUNTING, OR OTHER PROFESSIONAL SERVICES. IF
PROFESSIONAL ASSISTANCE IS REQUIRED, THE SERVICES OF A COMPETENT PROFESSIONAL PERSON
SHOULD BE SOUGHT. NEITHER THE PUBLISHER NOR THE AUTHOR SHALL BE LIABLE FOR DAMAGES
ARISING HEREFROM. THE FACT THAT AN ORGANIZATION OR WEBSITE IS REFERRED TO IN THIS
WORK AS A CITATION AND/OR A POTENTIAL SOURCE OF FURTHER INFORMATION DOES NOT MEAN
THAT THE AUTHOR OR THE PUBLISHER ENDORSES THE INFORMATION THE ORGANIZATION OR
WEBSITE MAY PROVIDE OR RECOMMENDATIONS IT MAY MAKE. FURTHER, READERS SHOULD BE
AWARE THAT INTERNET WEBSITES LISTED IN THIS WORK MAY HAVE CHANGED OR DISAPPEARED
BETWEEN WHEN THIS WORK WAS WRITTEN AND WHEN IT IS READ.
For general information on our other products and services, please contact our Customer Care
Department within the U.S. at 877-762-2974, outside the U.S. at 317-572-3993, or fax 317-572-4002.
For technical support, please visit www.wiley.com/techsupport.
Wiley also publishes its books in a variety of electronic formats and by print-on-demand. Some content
that appears in standard print versions of this book may not be available in other formats. For more
information about Wiley products, visit us at www.wiley.com.
British Library Cataloguing in Publication Data: A catalogue record for this book is available from the
British Library.
ISBN 978-1-119-96399-8 (pbk); ISBN 978-1-119-96631-9 (ebk); ISBN 978-1-119-96632-6 (ebk); ISBN 978-1-119-
96630-2 (ebk)
Printed and bound in the United States by Bind-Rite
10 9 8 7 6 5 4 3 2 1
www.it-ebooks.info
About the Author
Robert Hanmer is a director of The Hillside Group, an organization whose
mission is to improve quality of life for everyone who uses, builds, and
encounters software systems. The Hillside Group also sponsors Pattern
Languages of Programming (PLoP) software pattern conferences. Bob is
active in the software pattern community and has been program chair at
pattern conferences in the United States and overseas.
He is a consulting member of technical staff with Alcatel-Lucent near Chicago.
Within Alcatel-Lucent, Lucent Technologies, and Bell Laboratories (same
office, new company names), he is involved in development and architecture
of embedded systems, focusing especially on the areas of reliability and
performance. Previously, he designed interactive graphics systems used by
medical researchers.
Bob is the author of Patterns for Fault Tolerant Software (Wiley) and has
written or co-written 14 journal articles and several book chapters. He is a
senior member of the Association for Computing Machinery, a member of
the Alcatel-Lucent Technical Academy, and a member of the IEEE Computer
Society. He received his BS and MS degrees in Computer Science from
Northwestern University in Evanston, Illinois.
www.it-ebooks.info
www.it-ebooks.info
Dedication
For Karen
Author’s Acknowledgments
First, and most important, I want to acknowledge the authors of PatternOriented Software Architecture: A System of Patterns (Wiley): Frank
Buschmann, Regine Meunier, Hans Rohnert, Peter Sommerlad, and Michael
Stal. Peter also has been helpful with questions about modern C++ and the
software architecture classroom.
Many other people answered questions, reviewed sections, or generally
consulted with me while I was writing this book. Thanks to Ademar Aguiar,
Omar Aldawud, Dan Bergen, Filipe Correia, Chuck Corwin, Jerry Dzeidzic,
Christoph Fehling, Becky Fletcher, Brian Foote, Karen Hanmer, Kenji
Hiranabe, Lise Hvatum, Satomi Joba, Dr. Ralph Johnson, Capt. U.S. Navy
(Ret.) Will H. Jordan, Steven P. Karas, Allan Kelley, Christian Kohls, Christian
Koppe, John Krallman, John Letourneau, Steffen Macke, Dennis Mancl,
Jyothish Maniyath, Veena Mendiratta, Pedro Monteiro, Karl Rehmer, Linda
Rising, Hans Rudin, Eugene Wallingford, Michael Weiss, and Joe Yoder.
Thanks to the members of my writers’ workshop group at PLoP 2011 who held
a workshop on parts of this book: Dr. Tanya L. Crenshaw, Andre Hauge, Jiwon
Kim, Alexander Nowak, Rick Rodin, YoungSu Son, and Hironori Washizaki.
The Real-World Example sidebars in the pattern chapters are based on a
workshop at the 1998 OOPSLA conference. It was organized by Michael Duell,
Linda Rising, Peter Sommerlad, and Michael Stal. Russ Frame, Kandi Frasier,
Rik Smoody, and Jun’ichi Suzuki participated in the workshop and contributed to the examples that I’ve adapted here.
Thanks also to the many people at John Wiley & Sons, including Birgit
Gruber, Chris Katsaropoulos, Elizabeth Kuball, Ellie Scott, Jim Siddle,
Kathy Simpson, Chris Webb, and the others whose names you see on the
Publisher’s Acknowledgments page.
www.it-ebooks.info
Publisher’s Acknowledgments
We’re proud of this book; please send us your comments at http://dummies.custhelp.com.
For other comments, please contact our Customer Care Department within the U.S. at 877-762-2974,
outside the U.S. at 317-572-3993, or fax 317-572-4002.
Some of the people who helped bring this book to market include the following:
Acquisitions and Editorial
Project Editor: Elizabeth Kuball
Executive Commissioning Editor: Birgit Gruber
Assistant Editor: Ellie Scott
Copy Editor: Elizabeth Kuball
Technical Editor: James Siddle
Editorial Manager: Jodi Jensen
Sr. Project Editor: Sara Shlaer
Editorial Assistant: Leslie Saxman
Cover Photo: © teekid / iStock
Cartoons: Rich Tennant (www.the5thwave.com)
Composition Services
Senior Project Coordinator: Kristie Rees
Layout and Graphics: Joyce Haughey
Proofreaders: John Greenough, Tricia Liebig
Indexer: Sharon Shock
Marketing
Associate Marketing Director: Louise Breinholt
Marketing Manager: Lorna Mein
Senior Marketing Executive: Kate Parrett
Marketing Assistant: Tash Lee
UK Tech Publishing
Michelle Leete, Vice President Consumer and Technology Publishing Director
Martin Tribe, Associate Director–Book Content Management
Chris Webb, Associate Publisher
Publishing and Editorial for Technology Dummies
Richard Swadley, Vice President and Executive Group Publisher
Andy Cummings, Vice President and Publisher
Mary Bednarek, Executive Acquisitions Director
Mary C. Corder, Editorial Director
Publishing for Consumer Dummies
Kathleen Nebenhaus, Vice President and Executive Publisher
Composition Services
Debbie Stailey, Director of Composition Services
www.it-ebooks.info
Contents at a Glance
Introduction ................................................................ 1
Part I: Introducing Software Architecture and Patterns... 7
Chapter 1: Software Architecture Basics........................................................................9
Chapter 2: Where Do Architectures Come From? .......................................................25
Chapter 3: What Do Software Architectures Look Like? ............................................37
Chapter 4: Software Pattern Basics...............................................................................55
Chapter 5: Seeing How Patterns Are Made and Used .................................................73
Part II: Putting Patterns to Work ................................ 83
Chapter 6: Making Sense of Patterns.............................................................................85
Chapter 7: Building Your Own Pattern Catalog ...........................................................95
Chapter 8: Choosing a Pattern.....................................................................................103
Part III: Creating Your Application Architecture......... 115
Chapter 9: Building Functionality in Layers ...............................................................117
Chapter 10: Piping Your Data through Filters............................................................137
Chapter 11: Sharing Knowledge and Results on a Blackboard ................................151
Chapter 12: Coordinating Communication through a Broker..................................171
Chapter 13: Structuring Your Interactive Application with
Model-View-Controller................................................................................................189
Chapter 14: Layering Interactive Agents with PresentationAbstraction-Control ....................................................................................................209
Chapter 15: Putting Key Functions in a Microkernel ................................................229
Chapter 16: Reflecting and Adapting...........................................................................245
Part IV: Designing with Other POSA Patterns............. 263
Chapter 17: Decomposing the System’s Structure ....................................................265
Chapter 18: Making a Component the Master............................................................271
Chapter 19: Controlling Access....................................................................................277
Chapter 20: Managing the System ...............................................................................285
Chapter 21: Enhancing Interprocess Communication ..............................................295
Chapter 22: Counting the Number of References ......................................................309
www.it-ebooks.info
Part V: The Part of Tens ........................................... 319
Chapter 23: Ten Patterns You Should Know..............................................................321
Chapter 24: Ten Places to Look for Patterns..............................................................327
Chapter 25: Ten Ways to Get Involved with the Pattern Community .....................333
Index ...................................................................... 339
www.it-ebooks.info
Table of Contents
Introduction ................................................................. 1
About This Book ..............................................................................................1
Conventions Used in This Book.....................................................................2
What You’re Not to Read................................................................................3
Foolish Assumptions.......................................................................................3
How This Book Is Organized..........................................................................3
Part I: Introducing Software Architecture and Patterns ...................4
Part II: Putting Patterns to Work..........................................................4
Part III: Creating Your Application Architecture ...............................4
Part IV: Designing with Other POSA Patterns ....................................5
Part V: The Part of Tens........................................................................5
Icons Used in This Book .................................................................................5
Where to Go from Here...................................................................................6
Part I: Introducing Software Architecture and Patterns ... 7
Chapter 1: Software Architecture Basics . . . . . . . . . . . . . . . . . . . . . . . . 9
Understanding Software Architecture ..........................................................9
Components of software architecture ..............................................10
Architecture document.......................................................................11
Architecture models (views)..............................................................11
Software development methods and processes..............................12
Identifying the Problem to Be Solved .........................................................13
Breaking the problem into the four attributes.................................13
Developing a problem statement.......................................................14
Defining the important use cases ......................................................15
Identifying the Requirements.......................................................................18
Defining functional requirements ......................................................19
Defining nonfunctional requirements ...............................................19
Reviewing the requirements...............................................................22
Choosing a Software System Style...............................................................24
Architectural styles .............................................................................24
Programming style...............................................................................24
www.it-ebooks.info
xii Pattern-Oriented Software Architecture For Dummies
Chapter 2: Where Do Architectures Come From? . . . . . . . . . . . . . . . . . 25
Understanding Architectural Styles............................................................25
Elements of styles................................................................................26
Patterns and architectural styles ......................................................26
Creating Software Architecture ...................................................................27
Deciding when to create an architecture .........................................27
Identifying problem categories ..........................................................28
Defining layers and abstractions .......................................................28
Employing enabling techniques.........................................................30
Designing your architecture...............................................................33
Documenting your work .....................................................................35
Chapter 3: What Do Software Architectures Look Like? . . . . . . . . . . 37
Examining UML Architectural Models ........................................................37
Choosing a diagram style....................................................................37
Showing different views ......................................................................38
Working with UML Diagrams .......................................................................40
Creating class diagrams......................................................................40
Showing the interactions ....................................................................44
Deploying your system .......................................................................46
Packaging up the software..................................................................47
Using use-case diagrams.....................................................................48
Choosing Your Design Tools........................................................................49
Commercial software-development tools.........................................50
Free UML tools .....................................................................................50
General drawing tools .........................................................................51
Explaining Your Software in an Architecture Document..........................52
Organizing the architecture document.............................................52
Filling in the sections...........................................................................53
Chapter 4: Software Pattern Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
What Patterns Are .........................................................................................55
Reusable designs .................................................................................56
Proven solutions ..................................................................................58
Educational tools .................................................................................58
System guides.......................................................................................59
Architectural vocabularies.................................................................59
Repositories of expertise....................................................................60
What Patterns Are Not..................................................................................60
Looking Inside Patterns ................................................................................61
Title........................................................................................................62
Problem statement ..............................................................................62
Context..................................................................................................63
www.it-ebooks.info
Table of Contents xiii
Forces....................................................................................................64
Solution .................................................................................................66
Other common sections......................................................................67
Understanding the Patterns Used in This Book ........................................69
The Design Patterns pattern style .....................................................70
The Pattern-Oriented Software Architecture pattern style............71
Chapter 5: Seeing How Patterns Are Made and Used . . . . . . . . . . . . 73
Creating Patterns...........................................................................................73
Coming up with the idea .....................................................................74
Confirming the Rule of Three .............................................................75
Extracting the general solution..........................................................75
Writing the pattern document ...........................................................76
Naming the pattern..............................................................................77
Getting expert reviews ........................................................................77
Keeping patterns current....................................................................80
Documenting System Architecture with Patterns.....................................81
Part II: Putting Patterns to Work................................. 83
Chapter 6: Making Sense of Patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
Understanding Pattern Classifications .......................................................85
Styles .....................................................................................................86
Depth.....................................................................................................87
Other classifications............................................................................91
Grouping Patterns .........................................................................................92
Pattern collections...............................................................................92
Pattern languages ................................................................................93
Chapter 7: Building Your Own Pattern Catalog . . . . . . . . . . . . . . . . . . 95
Assembling Your Catalog .............................................................................96
Choosing a medium.............................................................................96
Identifying the problems you face.....................................................97
Finding patterns that solve your problems......................................97
Organizing the catalog in sections ....................................................98
Connecting the patterns ...................................................................100
Keeping Your Catalog Current...................................................................100
Chapter 8: Choosing a Pattern.................................103
Examining Patterns Critically.....................................................................103
Asking the right questions about patterns.....................................104
Knowing what to look for in a pattern ............................................104
www.it-ebooks.info