Object-Oriented and Classical Software Engineering Eighth Edition Stephen R. Schach Vanderbilt University sch76183_FM-i-xx.indd i 10/06/10 2:36 PM OBJECT-ORIENTED AND CLASSICAL SOFTWARE ENGINEERING, EIGHTH EDITION Published by McGraw-Hill, a business unit of The McGraw-Hill Companies, Inc., 1221 Avenue of the Americas, New York, NY 10020. Copyright © 2011 by The McGraw-Hill Companies, Inc. All rights reserved. Previous editions © 2007, 2005, and 2002. No part of this publication may be reproduced or distributed in any form or by any means, or stored in a database or retrieval system, without the prior written consent of The McGraw-Hill Companies, Inc., including, but not limited to, in any network or other electronic storage or transmission, or broadcast for distance learning. Some ancillaries, including electronic and print components, may not be available to customers outside the United States. This book is printed on acid-free paper. 1 2 3 4 5 6 7 8 9 0 DOC/DOC 1 0 9 8 7 6 5 4 3 2 1 0 ISBN 978-0-07-337618-9 MHID 0-07-337618-3 Vice President & Editor-in-Chief: Marty Lange Publisher: Raghothaman Srinivasan Vice President EDP & Central Publishing Services: Kimberly Meriwether David Development Editor: Lora Neyens Senior Marketing Manager: Curt Reynolds Project Manager: Melissa M. Leick Buyer: Kara Kudronowicz Design Coordinator: Brenda A. Rolwes Cover Designer: Studio Montage, St. Louis, Missouri Cover Image: © Photodisc/Getty Images Compositor: Glyph International Typeface: 10/12 Times Roman Printer: R. R. Donnelley All credits appearing on page or at the end of the book are considered to be an extension of the copyright page. Library of Congress Cataloging-in-Publication Data Schach, Stephen R. Object-oriented and classical software engineering / Stephen R. Schach. — 8th ed. p. cm. ISBN-13: 978-0-07-337618-9 (alk. paper) ISBN-10: 0-07-337618-3 (alk. paper) 1. Software engineering. 2. Object-oriented programming (Computer science) 3. UML (Computer science) 4. C++ (Computer program language) I. Title. QA76.758.S318 2010 005.1’17—dc22 2010020995 www.mhhe.com sch76183_FM-i-xx.indd ii 10/06/10 2:36 PM To Jackson and Mikaela sch76183_FM-i-xx.indd iii 10/06/10 2:36 PM The following are registered trademarks: ADF Analyst/Designer Ant Apache Apple AS/400 AT&T Bachman Product Set Bell Laboratories Borland Bugzilla Capability Maturity Model Chrome ClearCase ClearQuest CMM Cocoa Coca-Cola CORBA CppUnit CVS DB2 Eclipse e-Components Emeraude Enterprise JavaBeans eServer Excel Firefox Focus Ford Foundation Class Library FoxBASE GCC Hewlett-Packard IBM IMS/360 sch76183_FM-i-xx.indd iv Jackpot Source Code Metrics Java JBuilder JUnit Linux Lotus 1-2-3 Lucent Technologies MacApp Macintosh Macintosh Toolbox MacProject Microsoft Motif MS-DOS MVS/360 Natural Netscape New York Times Object C Objective-C ObjectWindows Library 1-800-flowers.com Oracle Oracle Developer Suite OS/360 OS/370 OS/VS2 Palm Pilot Parasoft Post-It Note PowerBuilder PREfix PREfast Project PureCoverage PVCS QARun Rational Requisite Pro Rhapsody Rose SBC Communications SilkTest SLAM Software through Pictures Solaris SourceSafe SPARCstation Sun Sun Enterprise Sun Microsystems Sun ONE Studio System Architect Together UNIX VAX Visual Component Library Visual C++ Visual J++ VM/370 VMS Wall Street Journal WebSphere Win32 Windows 95 Windows 2000 Windows NT Word X11 Xrunner XUnit Zip disk ZIP Code z10 10/06/10 2:36 PM Contents Preface xiii Chapter 1 The Scope of Software Engineering 1.1 1.2 1.3 1 Learning Objectives 1 Historical Aspects 2 Economic Aspects 5 Maintenance Aspects 6 2.4 2.5 2.6 2.7 2.8 2.9 2.9.1 Code-and-Fix Life-Cycle Model 52 2.9.2 Waterfall Life-Cycle Model 53 2.9.3 Rapid-Prototyping Life-Cycle Model 55 2.9.4 Open-Source Life-Cycle Model 56 2.9.5 Agile Processes 59 2.9.6 Synchronize-and-Stabilize Life-Cycle Model 62 2.9.7 Spiral Life-Cycle Model 62 1.3.1 Classical and Modern Views of Maintenance 9 1.3.2 The Importance of Postdelivery Maintenance 10 1.4 1.5 1.6 1.7 1.8 1.9 1.10 1.11 1.12 Requirements, Analysis, and Design Aspects 12 Team Development Aspects 15 Why There Is No Planning Phase 16 Why There Is No Testing Phase 16 Why There Is No Documentation Phase 17 The Object-Oriented Paradigm 18 The Object-Oriented Paradigm in Perspective 22 Terminology 23 Ethical Issues 26 Chapter Review 27 For Further Reading 27 Key Terms 28 Problems 29 References 30 2.10 Chapter 2 Software Life-Cycle Models 2.1 2.2 2.3 37 Learning Objectives 37 Software Development in Theory 37 Winburg Mini Case Study 38 Lessons of the Winburg Mini Case Study 42 Comparison of Life-Cycle Models Chapter Review 67 For Further Reading 68 Key Terms 69 Problems 69 References 70 Chapter 3 The Software Process 3.1 3.2 PART A SOFTWARE ENGINEERING CONCEPTS 35 Teal Tractors Mini Case Study 42 Iteration and Incrementation 43 Winburg Mini Case Study Revisited 47 Risks and Other Aspects of Iteration and Incrementation 48 Managing Iteration and Incrementation 51 Other Life-Cycle Models 52 3.3 3.4 3.5 3.6 3.7 66 74 Learning Objectives 74 The Unified Process 76 Iteration and Incrementation within the Object-Oriented Paradigm 76 The Requirements Workflow 78 The Analysis Workflow 80 The Design Workflow 82 The Implementation Workflow 83 The Test Workflow 84 3.7.1 Requirements Artifacts 84 3.7.2 Analysis Artifacts 84 3.7.3 Design Artifacts 85 3.7.4 Implementation Artifacts 85 3.8 Postdelivery Maintenance 87 v sch76183_FM-i-xx.indd v 10/06/10 2:36 PM vi Contents 3.9 3.10 Retirement 88 The Phases of the Unified Process 3.10.1 3.10.2 3.10.3 3.10.4 3.11 3.12 3.13 3.14 3.15 88 The Inception Phase 89 The Elaboration Phase 91 The Construction Phase 92 The Transition Phase 92 One- versus Two-Dimensional Life-Cycle Models 92 Improving the Software Process 94 Capability Maturity Models 95 Other Software Process Improvement Initiatives 98 Costs and Benefits of Software Process Improvement 99 Chapter Review 101 For Further Reading 102 Key Terms 102 Problems 103 References 104 Chapter 5 The Tools of the Trade 5.1 Learning Objectives 107 Team Organization 107 Democratic Team Approach 5.10 5.11 5.12 Classical Chief Programmer Team Approach 110 4.3.1 4.3.2 4.4 4.5 4.6 4.7 4.8 4.9 The New York Times Project 112 Impracticality of the Classical Chief Programmer Team Approach 113 Beyond Chief Programmer and Democratic Teams 113 Synchronize-and-Stabilize Teams 117 Teams for Agile Processes 118 Open-Source Programming Teams 118 People Capability Maturity Model 119 Choosing an Appropriate Team Organization 120 Chapter Review 121 For Further Reading 121 Key Terms 122 Problems 122 References 122 sch76183_FM-i-xx.indd vi Configuration Control 5.10.1 4.2.1 Analysis of the Democratic Team Approach 110 4.3 Cost–Benefit Analysis 130 Divide-and-Conquer 132 Separation of Concerns 132 Software Metrics 133 CASE 134 Taxonomy of CASE 135 Scope of CASE 137 Software Versions 141 5.10.2 5.10.3 109 Stepwise Refinement Mini Case Study 125 5.9.1 Revisions 141 5.9.2 Variations 142 Chapter 4 Teams 107 4.1 4.2 Learning Objectives 124 Stepwise Refinement 124 5.1.1 5.2 5.3 5.4 5.5 5.6 5.7 5.8 5.9 124 143 Configuration Control during Postdelivery Maintenance 145 Baselines 145 Configuration Control during Development 146 Build Tools 146 Productivity Gains with CASE Technology 147 Chapter Review 149 For Further Reading 149 Key Terms 150 Problems 150 References 151 Chapter 6 Testing 154 6.1 Learning Objectives 154 Quality Issues 155 6.1.1 6.1.2 6.2 Software Quality Assurance 156 Managerial Independence 156 Non-Execution-Based Testing 157 6.2.1 Walkthroughs 158 6.2.2 Managing Walkthroughs 158 6.2.3 Inspections 159 6.2.4 Comparison of Inspections and Walkthroughs 161 10/06/10 2:36 PM Contents 6.2.5 6.2.6 6.3 6.4 Strengths and Weaknesses of Reviews 162 Metrics for Inspections 162 7.4 7.4.1 Execution-Based Testing 162 What Should Be Tested? 163 7.4.2 6.4.1 Utility 164 6.4.2 Reliability 164 6.4.3 Robustness 165 6.4.4 Performance 165 6.4.5 Correctness 166 6.5 6.5.1 6.5.2 6.5.3 6.6 6.7 167 Who Should Perform Execution-Based Testing? 175 When Testing Stops 176 Chapter Review 176 For Further Reading 177 Key Terms 177 Problems 178 References 179 Coupling 8.1 8.2 8.3 Raytheon Missile Systems Division 230 European Space Agency 231 Objects and Reuse 232 Reuse during Design and Implementation 232 8.5.1 Design Reuse 232 8.5.2 Application Frameworks 234 8.5.3 Design Patterns 235 8.5.4 Software Architecture 236 8.5.5 Component-Based Software Engineering 237 8.6 More on Design Patterns 8.6.1 8.6.2 8.6.3 8.6.4 8.6.5 8.7 8.8 198 225 Learning Objectives 225 Reuse Concepts 226 Impediments to Reuse 228 Reuse Case Studies 229 8.3.2 8.4 8.5 192 7.3.1 Content Coupling 192 7.3.2 Common Coupling 193 7.3.3 Control Coupling 195 7.3.4 Stamp Coupling 195 7.3.5 Data Coupling 196 7.3.6 Coupling Example 197 7.3.7 The Importance of Coupling sch76183_FM-i-xx.indd vii Chapter 8 Reusability and Portability 183 Learning Objectives 183 What Is a Module? 183 Cohesion 187 199 Data Encapsulation and Development 201 Data Encapsulation and Maintenance 202 Abstract Data Types 207 Information Hiding 209 Objects 211 Inheritance, Polymorphism, and Dynamic Binding 215 The Object-Oriented Paradigm 217 Chapter Review 220 For Further Reading 221 Key Terms 221 Problems 221 References 222 8.3.1 7.2.1 Coincidental Cohesion 187 7.2.2 Logical Cohesion 188 7.2.3 Temporal Cohesion 189 7.2.4 Procedural Cohesion 189 7.2.5 Communicational Cohesion 190 7.2.6 Functional Cohesion 190 7.2.7 Informational Cohesion 191 7.2.8 Cohesion Example 191 7.3 7.9 Example of a Correctness Proof 167 Correctness Proof Mini Case Study 171 Correctness Proofs and Software Engineering 172 Chapter 7 From Modules to Objects 7.1 7.2 7.5 7.6 7.7 7.8 Testing versus Correctness Proofs Data Encapsulation vii 8.9 237 FLIC Mini Case Study 238 Adapter Design Pattern 239 Bridge Design Pattern 240 Iterator Design Pattern 241 Abstract Factory Design Pattern 241 Categories of Design Patterns 245 Strengths and Weaknesses of Design Patterns 247 Reuse and the World Wide Web 248 10/06/10 2:36 PM viii Contents 8.10 8.11 Reuse and Postdelivery Maintenance Portability 250 Chapter Review 292 For Further Reading 292 Key Terms 293 Problems 294 References 295 249 8.11.1 8.11.2 Hardware Incompatibilities 250 Operating System Incompatibilities 251 8.11.3 Numerical Software Incompatibilities 251 8.11.4 Compiler Incompatibilities 253 8.12 8.13 Why Portability? 255 Techniques for Achieving Portability 8.13.1 8.13.2 8.13.3 8.13.4 PART B 256 Portable System Software 257 Portable Application Software 257 Portable Data 258 Model-Driven Architecture 259 Chapter Review 259 For Further Reading 260 Key Terms 261 Problems 261 References 263 CHAPTER 9 Planning and Estimating 9.1 9.2 268 Learning Objectives 268 Planning and the Software Process 268 Estimating Duration and Cost 270 9.2.1 Metrics for the Size of a Product 272 9.2.2 Techniques of Cost Estimation 275 9.2.3 Intermediate COCOMO 278 9.2.4 COCOMO II 281 9.2.5 Tracking Duration and Cost Estimates 282 9.3 9.4 9.5 9.6 9.7 9.8 9.9 9.10 9.11 Components of a Software Project Management Plan 282 Software Project Management Plan Framework 284 IEEE Software Project Management Plan 286 Planning Testing 288 Planning Object-Oriented Projects 289 Training Requirements 290 Documentation Standards 291 CASE Tools for Planning and Estimating 292 Testing the Software Project Management Plan 292 sch76183_FM-i-xx.indd viii THE WORKFLOWS OF THE SOFTWARE LIFE CYCLE 299 Chapter 10 Key Material from Part A 10.1 10.2 10.3 10.4 10.5 10.6 10.7 10.8 10.9 10.10 10.11 10.12 10.13 10.14 Learning Objective 301 Software Development: Theory versus Practice 301 Iteration and Incrementation 302 The Unified Process 306 Workflow Overview 307 Teams 307 Cost–Benefit Analysis 308 Metrics 308 CASE 308 Versions and Configurations 309 Testing Terminology 309 Execution-Based and Non-ExecutionBased Testing 309 Modularity 310 Reuse 310 Software Project Management Plan 310 Chapter Review 311 Key Terms 311 Problems 312 Chapter 11 Requirements 11.1 11.2 11.3 11.4 301 313 Learning Objectives 313 Determining What the Client Needs Overview of the Requirements Workflow 314 Understanding the Domain 315 The Business Model 316 11.4.1 11.4.2 11.4.3 313 Interviewing 316 Other Techniques 317 Use Cases 318 10/06/10 2:36 PM Contents 11.5 11.6 11.7 11.8 11.9 11.10 11.11 11.12 11.13 11.14 11.15 11.16 11.17 11.18 Initial Requirements 319 Initial Understanding of the Domain: The MSG Foundation Case Study 320 Initial Business Model: The MSG Foundation Case Study 322 Initial Requirements: The MSG Foundation Case Study 326 Continuing the Requirements Workflow: The MSG Foundation Case Study 328 Revising the Requirements: The MSG Foundation Case Study 330 The Test Workflow: The MSG Foundation Case Study 338 The Classical Requirements Phase 347 Rapid Prototyping 348 Human Factors 349 Reusing the Rapid Prototype 351 CASE Tools for the Requirements Workflow 353 Metrics for the Requirements Workflow 353 Challenges of the Requirements Workflow 354 Chapter Review 355 For Further Reading 356 Key Terms 357 Case Study Key Terms 357 Problems 357 References 358 Chapter 12 Classical Analysis 12.1 12.2 12.3 12.5 12.6 sch76183_FM-i-xx.indd ix 12.8 12.9 Structured Systems Analysis: The MSG Foundation Case Study 372 Other Semiformal Techniques 373 Entity-Relationship Modeling 374 382 Petri Nets: The Elevator Problem Case Study 385 387 12.9.1 Z: The Elevator Problem Case Study 388 12.9.2 Analysis of Z 390 12.10 12.11 12.12 12.13 12.14 12.15 12.16 Other Formal Techniques 392 Comparison of Classical Analysis Techniques 392 Testing during Classical Analysis 393 CASE Tools for Classical Analysis 394 Metrics for Classical Analysis 395 Software Project Management Plan: The MSG Foundation Case Study 395 Challenges of Classical Analysis 396 Chapter Review 396 For Further Reading 397 Key Terms 398 Case Study Key Terms 398 Problems 398 References 400 Chapter 13 Object-Oriented Analysis 13.4 13.5 13.6 13.7 13.8 404 Learning Objectives 404 The Analysis Workflow 405 Extracting the Entity Classes 406 Object-Oriented Analysis: The Elevator Problem Case Study 407 Functional Modeling: The Elevator Problem Case Study 407 Entity Class Modeling: The Elevator Problem Case Study 410 13.5.1 13.5.2 364 Sally’s Software Shop Mini Case Study 364 Z 376 Finite State Machines: The Elevator Problem Case Study 378 Petri Nets 12.8.1 Correctness Proof Mini Case Study Redux 363 Structured Systems Analysis 12.3.1 12.4 360 Finite State Machines 12.7.1 13.1 13.2 13.3 Learning Objectives 360 The Specification Document 360 Informal Specifications 362 12.2.1 12.7 ix Noun Extraction 411 CRC Cards 413 Dynamic Modeling: The Elevator Problem Case Study 414 The Test Workflow: Object-Oriented Analysis 417 Extracting the Boundary and Control Classes 424 10/06/10 2:36 PM