UML Distilled Third Edition UML Distilled Third Edition
Total Page:16
File Type:pdf, Size:1020Kb
Praise for UML Distilled “UML Distilled remains the best introduction to UML notation. Martin’s agile and pragmatic approach hits the sweet spot, and I wholeheartedly recommend it!” —Craig Larman Author of Applying UML and Patterns “Fowler cuts through the complexity of UML to get users started quickly.” —Jim Rumbaugh Author and originator of UML “Martin Fowler’s UML Distilled is an excellent way to get started with UML. In fact for most users, UML Distilled contains all you need to apply UML suc- cessfully. As Martin points out, UML can be used in many ways, but the most common is as a widely recognized notation for sketching designs. This book does an excellent job of distilling the essence of UML. Highly recommended.” —Steve Cook Software Architect Microsoft Corporation “Short books on UML are better than long books on UML. This is still the best short book on UML. In fact, it’s the best short book on many subjects.” —Alistair Cockburn Author and President, Humans and Technology “The book is immensely useful, readable, and—one of its great virtues— delightfully concise for the immense scope of its subject. If you only buy one book on UML, this should be it.” —Andy Carmichael BetterSoftwareFaster, Ltd. “If you’re using UML, this book should never be out of reach.” —John Crupi Distinguished Engineer, Sun Microsystems Coauthor of Core J2EE™ Patterns “Anyone doing UML modeling, learning UML, reading UML, or building UML tools should have this latest edition. (I own all editions.) There is lots of good, useful information; generally, just enough to be useful, but not too much to be dry. It’s a must-have reference for my bookshelf!” —Jon Kern Modeler “This is a great starting point for learning the fundamentals of the UML.” —Scott W. Ambler Author of Agile Modeling “An eminently sensible description of UML and its usage, with enough humor to hold one’s attention. ‘The swimming metaphor no longer holds water’ indeed!” —Stephen J. Mellor Coauthor of Executable UML “This is the perfect book for those who want to use the UML but aren’t inter- ested in reading thick UML reference books and research papers. Martin Fowler selects all the critical techniques needed to use the UML for design sketches, freeing the reader from complex and rarely used UML features. Read- ers will find no shortage of suggestions for further reading. He gives the reader advice based on experience. It’s a concise and readable book covering the essen- tial aspects of the UML and related object-oriented concepts.” —Pavel Hruby Microsoft Business Solutions “Like all good software developers, Fowler improves his product with each iter- ation. This is the only book I consider when teaching a class involving UML or if asked to recommend one that can be used to learn it.” —Charles Ashbacher President/CEO, Charles Ashbacher Technologies “More books should be like UML Distilled—concise and readable. Martin Fowler selects the parts of UML that you need, and presents them in an easy to read style. More valuable than a mere description of the modeling language, however, is the author’s insight and experience in how to use this technique to communicate and document design.” —Rob Purser Purser Consulting, LLC. UML Distilled Third Edition UML Distilled Third Edition A Brief Guide to the Standard Object Modeling Language Martin Fowler Boston • San Francisco • New York • Toronto • Montreal London • Munich • Paris • Madrid Capetown • Sydney • Tokyo • Singapore • Mexico City Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and Addison- Wesley was aware of a trademark claim, the designations have been printed with initial capital letters or in all capitals. The author and publisher have taken care in the preparation of this book, but make no expressed or implied warranty of any kind and assume no responsibility for errors or omissions. No liability is assumed for incidental or consequential damages in connection with or arising out of the use of the information or programs contained herein. For information about buying this title in bulk quantities, or for special sales opportuni- ties (which may include electronic versions; custom cover designs; and content particular to your business, training goals, marketing focus, or branding interests), please contact our corporate sales department at [email protected] or (800) 382-3419. For government sales inquiries, please contact [email protected]. For questions about sales outside the U.S., please contact [email protected]. Visit us on the Web: informit.com/aw Library of Congress Cataloging-in-Publication Data Fowler, Martin, 1963– UML distilled : a brief guide to the standard object modeling language / Martin Fowler.—3rd ed. p. cm. Includes bibliographical references and index. ISBN 0-321-19368-7 (alk. paper) 1. Object-oriented methods (Computer science) 2. Computer software— Development. 3. UML (Computer science) I. Title. QA76.9.O35F695 2003 005.1'7—dc22 2003057759 Copyright © 2004 by Pearson Education, Inc. All rights reserved. Printed in the United States of America. This publication is protected by copyright, and permission must be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permissions, request forms and the appropriate contacts within the Pearson Education Global Rights & Permissions Department, please visit www.pearsoned.com/permissions/. ISBN-13: 978-0-321-19368-1 ISBN-10: 0-321-19368-7 22 17 For Cindy This page intentionally left blank Contents List of Figures . .xvii Foreword to the Third Edition . xxi Foreword to the First Edition . xxiii Preface . xxv Why Bother with the UML? . xxvi Structure of the Book . .xxvii Changes for the Third Edition . .xxvii Acknowledgments . xxviii Chapter 1: Introduction . 1 What Is the UML? . .1 Ways of Using the UML . .2 How We Got to the UML . .7 Notations and Meta-Models . .9 UML Diagrams . .10 What Is Legal UML? . .13 The Meaning of UML . .14 UML Is Not Enough . .14 Where to Start with the UML . .16 Where to Find Out More . .16 Chapter 2: Development Process . 19 Iterative and Waterfall Processes . .19 Predictive and Adaptive Planning . .23 Agile Processes . .24 Rational Unified Process . .25 xi xii CONTENTS Fitting a Process to a Project . .26 Fitting the UML into a Process . .29 Requirements Analysis . .29 Design . .30 Documentation . .31 Understanding Legacy Code . .32 Choosing a Development Process . .33 Where to Find Out More . .33 Chapter 3: Class Diagrams: The Essentials . 35 Properties . .35 Attributes . .36 Associations . .37 Multiplicity . .38 Programming Interpretation of Properties . .39 Bidirectional Associations . .41 Operations . .43 Generalization . .45 Notes and Comments . .46 Dependency . .47 Constraint Rules . .49 When to Use Class Diagrams . .51 Where to Find Out More . .52 Chapter 4: Sequence Diagrams . 53 Creating and Deleting Participants . .56 Loops, Conditionals, and the Like . .57 Synchronous and Asynchronous Calls . .61 When to Use Sequence Diagrams . .61 Chapter 5: Class Diagrams: Advanced Concepts . 65 Keywords . .65 Responsibilities . .66 Static Operations and Attributes . .66 Aggregation and Composition . .67 Derived Properties . .68 Interfaces and Abstract Classes . .69 Read-Only and Frozen . .72 Reference Objects and Value Objects . .73 CONTENTS xiii Qualified Associations . .74 Classification and Generalization . .75 Multiple and Dynamic Classification . .76 Association Class . .78 Template (Parameterized) Class . .81 Enumerations . .82 Active Class . .83 Visibility . .83 Messages . .84 Chapter 6: Object Diagrams . 87 When to Use Object Diagrams . .87 Chapter 7: Package Diagrams . ..