Object-Oriented & Classical Soft Engineering Seventh Edition Stephen R. Schach Vanderbilt University Higher Education Boston Burr Ridge, IL Dubuque, IA New York San Francisco St. Louis Bangkok Bogota Caracas Kuala Lumpur Lisbon London Madrid Mexico City Milan Montreal New Delhi Santiago Seoul Singapore Sydney Taipei Toronto
Contents Preface v PART ONE INTRODUCTION TO SOFTWARE ENGINEERING 1 Chapter 1 The Scope of Software Engineering 3 Learning Objectives 3 1.1 Historical Aspects 4 1.2 Economic Aspects 7 1.3 Maintenance Aspects 8 1.3.1 Classical and Modern Views of Maintenance 9 1.3.2 The Importance of Postdelivery Maintenance 11 1.4 Requirements, Analysis, and Design Aspects 13 1.5 Team Development Aspects 16 1.6 Why There 1s No Planning Phase 17 1.7 Why There Is No Testing Phase 17 1.8 Why There Is No Documentation Phase 18 1.9 The Object-Oriented Paradigm 19 1.10 The Object-Oriented Paradigm in Perspective 23 1.11 Terminology 24 1.12 Ethical Issues 27 Chapter Review 28 For Further Reading 28 Key Terms 29 Problems 30 References 31 Chapter 2 Software Life-Cycle Models 35 Learning Objectives 35 2.1 Software Development in Theory 35 2.2 Winburg Mini Case Study 36 2.3 Lessons of the Winburg Mini Case Study 40 2.4 Teal Tractors Mini Case Study 40 2.5 Iteration and Incrementation 41 2.6 Winburg Mini Case Study Revisited 45 2.7 Risks and Other Aspects of Iteration and Incrementation 46 2.8 Managing Iteration and Incrementation 49 2.9 Other Life-Cycle Models 50 2.9.1 Code-and-Fix Life-Cycle Model 50 2.9.2 Waterfall Life-Cycle Model 51 2.9.3 Rapid-Prototyping Life-Cycle Model 53 2.9.4 Open-Source Life-Cycle Model 54 2.9.5 Agile Processes 57 2.9.6 Synchronize-and-Stabilize Life-Cycle Model 60 2.9.7 Spiral Life-Cycle Model 60 2.10 Comparison of Life-Cycle Models 64 Chapter Review 65 For Further Reading 66 Key Terms 67 Problems 67 References 68 Chapter 3 The Software Process 71 Learning Objectives 71 3.1 The Unified Process 73 3.2 Iteration and Incrementation within the Object-Oriented Paradigm 73 3.3 The Requirements Workflow 75 3.4 The Analysis Workflow 77 3.5 The Design Workflow 79 3.6 The Implementation Workflow 80 3.7 The Test Workflow 81 3.7.1 Requirements Artifacts 81 3.7.2 Analysis Artifacts 81 3.7.3 Design Artifacts 82 3.7.4 Implementation Artifacts 82 xiii
xiv Contents 3.8 Postdelivery Maintenance 84 3.9 Retirement 85 3.10 The Phases of the Unified Process 85 3.10.1 The Inception Phase 86 3.10.2 The Elaboration Phase 88 3.10.3 The Construction Phase 89 3.10.4 The Transition Phase 89 3.11 One- versus Two-Dimensional Life-Cycle Models 90 3.12 Improving the Software Process 92 3.13 Capability Maturity Models 92 3.14 Other Software Process Improvement Initiatives 95 3.15 Costs and Benefits of Software Process Improvement 96 Chapter Review 98 For Further Reading 98 Key Terms 99 Problems 100 References 100 Chapter 4 Teams 104 Learning Objectives 104 4.1 Team Organization 104 4.2 Democratic Team Approach 106 4.2.1 Analysis ofthe Democratic Team Approach 107 4.3 Classical Chief Programmer Team Approach 107 4.3.1 The New York Times Project 109 4.3.2 lmpracticality ofthe Classical Chief Programmer Team Approach 110 4.4 Beyond Chief Programmer and Democratic Teams 110 4.5 Synchronize-and-Stabilize Teams 114 4.6 Teams for Agile Processes 115 4.7 Open-Source Programming Teams 115 4.8 People Capability Maturity Model 116 4.9 Choosing an Appropriate Team Organization 117 Chapter Review 118 For Further Reading 118 Key Terms 118 Problems 119 References 119 Chapter 5 The Tools of the Trade 121 Learning Objectives 121 5.1 Stepwise Refinement 121 5.1.1 Stepwise Refinement Mini Case Study 122 5.2 Cost-Benefit Analysis 127 5.3 Software Metrics 129 5.4 CASE 130 5.5 TaxonomyofCASE 131 5.6 ScopeofCASE 133 5.7 Software Versions 136 5.7.1 Revisions 137 5.7.2 Variations 137 5.8 Configuration Control 138 5.8.1 Configuration Control during Postdelivery Maintenance 140 5.8.2 Baselines 140 5.8.3 Configuration Control during Development 141 5.9 Build Tools 141 5.10 Productivity Gains with CASE Technology 142 Chapter Review 144 For Further Reading 144 Key Terms 144 Problems 145 References 146 Chapter 6 Testing 149 Learning Objectives 149 6.1 Quality Issues 150 6.1.1 Software Quality Assurance 151 6.1.2 Managerial Independence 151 6.2 Non-Execution-Based Testing 152 6.2.1 Walkthroughs 153 6.2.2 Managing Walkthroughs 153 6.2.3 Inspections 154
Contents xv 6.2.4 Comparison of Inspections and Walkthroughs 156 6.2.5 Strengths and Weaknesses of Reviews 157 6.2.6 Metrics fbr Inspections 157 6.3 Execution-Based Testing 157 6.4 What Should Be Tested? 158 6.4.1 Utility 159 6.4.2 Reliability 159 6.4.3 Robustness 160 6.4.4 Performance 160 6.4.5 Correctness 161 6.5 Testing versus Correctness Proofs 162 6.5.1 Example of a Correctness Proof 162 6.5.2 Correctness Proof Mini Case Study 166 6.5.3 Correctness Proofs and Software Engineering 167 6.6 Who Should Perform Execution-Based Testing? 170 6.7 When Testing Stops 171 Chapter Review 171 For Further Reading 172 Key Terms 172 Problems 173 References 174 Chapter 7 From Modules to Objects 177 Learning Objectives 177 7.1 What Is a Module? 177 7.2 Cohesion 181 7.2.1 Coincidental Cohesion 181 7.2.2 Logical Cohesion 182 7.2.3 Temporal Cohesion 183 7.2.4 Procedural Cohesion 183 7.2.5 Communicational Cohesion 184 7.2.6 Functional Cohesion 184 7.2.7 Informational Cohesion 185 7.2.8 Cohesion Example 185 7.3 Coupling 186 7.3.1 Content Coupling 186 7.3.2 Common Coupling 187 7.3.3 Control Coupling 189 7.3.4 Stamp Coupling 190 7.3.5 Data Coupling 191 7.3.6 Coupling Example 191 7.3.7 The Importance of Coupling 192 7.4 Data Encapsulation 193 7.4.1 Data Encapsulation and Development 196 7.4.2 Data Encapsulation and Maintenance 197 7.5 Abstract Data Types 202 7.6 Information Hiding 203 7.7 Objects 205 7.8 Inheritance, Polymorphism, and Dynamic Binding 209 7.9 The Object-Oriented Paradigm 212 Chapter Review 214 For Further Reading 215 Key Terms 215 Problems 216 References 217 Chapter 8 Reusability and Portability 219 Learning Objectives 219 8.1 Reuse Concepts 220 8.2 Impediments to Reuse 222 8.3 Reuse Case Studies 223 8.3.1 Raytheon Missile Systems Division 224 8.3.2 European Space Agency 225 8.4 Objects and Reuse 226 8.5 Reuse during Design and Implementation 226 8.5.1 Design Reuse 226 8.5.2 Applikation Frameworks 228 8.5.3 Design Patterns 229 8.5.4 Software Architecture 233 8.5.5 Component-Based Software Engineering 233 8.6 Reuse and Postdelivery Maintenance 234 8.7 Portability 235 8.7.1 Hardware Incompatibilities 235 8.7.2 Operating System Incompatibilities 236 8.7.3 Numerical Software Incompatibilities 236 8.7.4 Compiler Incompatibilities 237
xvi Contents 8.8 Why Portability? 241 8.9 Techniques for Achieving Portability 241 8.9.1 Portable System Software 242 8.9.2 Portable Application Software 242 8.9.3 Portable Data 243 Chapter Review 244 For Further Reading 245 Key Terms 246 Problems 246, References 247, Chapter 9 Planning and Estimating 252 Learning Objectives 252 9.1 Planning and the Software Process 253 9.2 Estimating Duration and Cost 254 9.2.1 Metricsfor the Size ofa Product 256 9.2.2 Techniques of Cost Estimation 259 9.2.3 Intermediate COCOMO 262 9.2.4 COCOMO II 265 9.2.5 Tracking Duration and Cost Estimates 266 9.3 Components of a Software Project Management Plan 266 9.4 Software Project Management Plan Framework 268 9.5 IEEE Software Project Management Plan 270 9.6 Planning Testing 273 9.7 Planning Object-Oriented Projects 274 9.8 Training Requirements 274 9.9 Documentation Standards 275 9.10 CASE Tools for Planning and Estimating 276 9.11 Testing the Software Project Management Plan 276 Chapter Review 276 For Further Reading 277 Key Terms 277 Problems 278 References 279 PART TWO THE WORKFLOWS OF THE SOFTWARE LIFE CYCLE 283 Chapter 10 Requirements 285 Learning Objectives 285 10.1 Determining What the Client Needs 285 10.2 Overview of the Requirements Workflow 286 10.3 Understanding the Domain 287 10.4 The Business Model 288 10.4.1 Interviewing 288 10.4.2 Other Techniques 289 10.4.3 Use Cases 290 10.5 Initial Requirements 291 10.6 Initial Understanding of the Domain: The MSG Foundation Case Study 292 10.7 Initial Business Model: The MSG Foundation Case Study 294 10.8 Initial Requirements: The MSG Foundation Case Study 298 10.9 Continuing the Requirements Workflow: The MSG Foundation Case Study 300 10.10 Revising the Requirements: The MSG Foundation Case Study 302 10.11 The Test Workflow: The MSG Foundation Case Study 310 10.12 The Classical Requirements Phase 319 10.13 Rapid Prototyping 320 10.14 Human Factors 321 10.15 Reusing the Rapid Prototype 323 10.16 CASE Tools for the Requirements Workflow 324 10.17 Metrics for the Requirements Workflow 325 10.18 Challenges of the Requirements Workflow 325 Chapter Review 327 For Further Reading 327 Key Terms 327 Case Study Key Terms 328 Problems 328 References 329
Contents xvii Chapter 11 Classical Analysis 331 Learning Objectives 331 11.1 The Specification Document 331 11.2 Informal Specifications 333 11.2.1 Correctness ProofMini Case Study Redux 334 11.3 Structured Systems Analysi s 335 11.3.1 Salfy 's Software Shop Mini Case Study 335 1T.4 Structured Systems Analysis: The MSG Foundation Case Study 343 11.5 Other Semiformal Techniques 344 11.6 Entity-Relationship Modeling 345 11.7 Finite State Machines 347 11.7.1 Finite State Machines: The Elevator Problem Case Study 349 11.8 PetriNets 353 11.8.1 Petri Nets: The Elevator Problem Case Study 356 11.9 Z 358 11.9.1 Z: The Elevator Problem Case Study 359 11.9.2 Analysis ofz 361 11.10 Other Formal Techniques 363 11.11 Comparison of Classical Analysis Techniques 363 11.12 Testing during Classical Analysis 365 11.13 CASE Tools for Classical Analysis 365 11.14 Metrics for Classical Analysis 366 11.15 Software Project Management Plan: The MSG Foundation Case Study 366 11.16 Challenges of Classical Analysis 367 Chapter Review 367 For Further Reading 368 Key Terms 368 Case Study Key Terms 369 Problems 369 References 371 Chapter12 Object-Oriented Analysis 375 Learning Objectives 375 12.1 The Analysis Workflow 376 12.2 Extracting the Entity Classes 377 12.3 Object-Oriented Analysis: The Elevator Problem Case Study 378 12.4 Functional Modeling: The Elevator Problem Case Study 378 12.5 Entity Class Modeling: The Elevator Problem Case Study 380 12.5.1 Noun Extraction 381 12.5.2 CRC Cards 383 12.6 Dynamic Modeling: The Elevator Problem Case Study 384 12.7 The Test Workflow: Object-Oriented Analysis 387 12.8 Extracting the Boundary and Control Classes 391 12.9 The Initial Functional Model: The MSG Foundation Case Study 392 12.10 The Initial Class Diagram: The MSG Foundation Case Study 395 12.11 The Initial Dynamic Model: The MSG Foundation Case Study 397 12.12 Revising the Entity Classes: The MSG Foundation Case Study 399 12.13 Extracting the Boundary Classes: The MSG Foundation Case Study 401 12.14 Extracting the Control Classes: The MSG Foundation Case Study 401 12.15 Use-Case Realization: The MSG Foundation Case Study 402 12.15.1 Estimate Funds Available for Week Use Case 402 12.15.2 Manage an Asset Use Case 409 12.15.3 Update Estimated Annual Operating Expenses Use Case 413 12.15.4 Produce a Report Use Case 416 12.16 Incrementing the Class Diagram: The MSG Foundation Case Study 421 12.17 The Test Workflow: The MSG Foundation Case Study 423 12.18 The Specification Document in the Unified Process 423 12.19 More on Actors and Use Cases 424 12.20 CASE Tools for the Object-Oriented Analysis Workflow 425
xviii Contents 12.21 Challenges of the Object-Oriented Analysis Workflow 425 Chapter Review 426 For Further Reading 427 Key Terms 427 Problems 428 References 429 Chapter 13 Design 431, Learning Objectives 431 13.1 Design and Abstraction 432 13.2 Operation-Oriented Design 432 13.3 Data Flow Analysis 433 13.3.1 Mini Case Study: Word Counting 434 13.3.2 Data Flow Analysis Extensions 439 13.4 Transaction Analysis 439 13.5 Data-Oriented Design 441 13.6 Object-Oriented Design 442 13.7 Object-Oriented Design: The Elevator Problem Case Study 443 13.8 Object-Oriented Design: The MSG Foundation Case Study 446 13.9 The Design Workflow 451 13.10 The Test Workflow: Design 453 13.11 The Test Workflow: The MSG Foundation Case Study 453 13.12 Formal Techniques for Detailed Design 454 13.13 Real-Time Design Techniques 454 13.14 CASE Tools for Design 455 13.15 Metrics for Design 456 13.16 Challenges of the Design Workflow 457 Chapter Review 458 For Further Reading 458 Key Terms 459 Problems 459 References 460 Chapter 14 Implementation 463 Learning Objectives 463 14.1 Choice of Programming Language 463 14.2 Fourth-Generation Languages 466 14.3 Good Programming Practice 469 14.3.1 Use of Consistent and Meaningful Variable Names 469 14.3.2 The Issue of Self-Documenting Code 470 14.3.3 Use of Parameters 472 14.3.4 Code Layout for Increased Readability 472 14.3.5 Nested if Statements 472 14.4 Coding Standards 474 14.5 Code Reuse 475 14.6 Integration 475 14.6.1 Top-down Integration 476 14.6.2 Bottom-up Integration 478 14.6.3 Sandwich Integration 478 14.6.4 Integration of Object-Oriented Products 479 14.6.5 Management of Integration 480 14.7 The Implementation Workflow 481 14.8 The Implementation Workflow: The MSG Foundation Case Study 481 14.9 The Test Workflow: Implementation 481 14.10 Test Case Selection 482 14.10.1 Testing to Specifications versus Testing to Code 482 14.10.2 Feasibility of Testing to Specifications 482 14.10.3 Feasibility of Testing to Code 483 14.11 Black-Box Unit-Testing Techniques 485 14.11.1 Equivalence Testing and Boundary Value Analysis 486 14.11.2 Functional Testing 487 14.12 Black-Box Test Cases: The MSG Foundation Case Study 488 14.13 Glass-Box Unit-Testing Techniques 490 14.13.1 Structural Testing: Statement, Branch, and Path Coverage 491 14.13.2 Complexity Metrics 492 14.14 Code Walkthroughs and Inspections 493 14.15 Comparison of Unit-Testing Techniques 493 14.16 Cleanroom 494 14.17 Potential Problems When Testing Objects 495 14.18 Management Aspects of Unit Testing 498
Contents xix 14.19 When to Rewrite Rather than Debug a Code Artifact 498 14.20 Integration Testing 499 14.21 Product Testing 500 14.22 Acceptance Testing 501 14.23 The Test Workflow: The MSG Foundation Case Study 502 14.24 CASE Tools for Implementation 502 14.24.1 CASE Tools for the Complete Software Process 503 14.24.2 Integrated Development Environments 503 14.24.3 Environments for Business Applications 504 14.24.4 Public Tool Infrastructures 505 14.24.5 Potential Problems with Environments 505 14.25 CASE Tools for the Test Workflow 505 14.26 Metrics for the Implementation Workflow 506 14.27 Challenges of the Implementation Workflow 507 Chapter Review 507 For Further Reading 508 Key Terms 509 Problems 509 References 511 Chapter15 Postdelivery Maintenance 515 Learning Obj ectives 515 15.1 Development and Maintenance 515 15.2 Why Postdelivery Maintenance IsNecessary 517 15.3 What Is Required of Postdelivery Maintenance Programmers? 517 15.4 Postdelivery Maintenance Mini Case Study 520 15.5 Management of Postdelivery Maintenance 521 15.5.1 Defect Reports 521 15.5.2 Authorizing Changes to the Product 522 15.5.3 Ensuring Maintainability 523 15.5.4 Problem of Repeated Maintenance 523 15.6 Maintenance of Obj ect-oriented Software 524 15.7 Postdelivery Maintenance Skills versus Development Skills 527 15.8 Reverse Engineering 527 15.9 Testing during Postdelivery Maintenance 528 15.10 CASE Tools for Postdelivery Maintenance 529 15.11 Metrics for Postdelivery Maintenance 530 15.12 Postdelivery Maintenance: The MSG Foundation Case Study 530 15.13 Challenges of Postdelivery Maintenance 530 Chapter Review 531 For Further Reading 531 Key Terms 532 Problems 532 References 533 Chapter 16 More on UML 535 Learning Objectives 535 16.1 UML Is Not a Methodology 535 16.2 Class Diagrams 536 16.2.1 Aggregation 537 16.2.2 Multiplicity 538 16.2.3 Composition 539 16.2.4 Generalization 540 16.2.5 Association 540 16.3 Notes 541 16.4 Use-Case Diagrams 541 16.5 Stereotypes 541 16.6 Interaction Diagrams 543 16.7 Statecharts 545 16.8 Activity Diagrams 547 16.9 Packages 549 16.10 Component Diagrams 550 16.11 Deployment Diagrams 550 16.12 Review of UML Diagrams 551 16.13 UML and Iteration 5 51 Chapter Review 551
XX Contents For Further Reading 552 Key Terms 552 Problems 552 References 553 Bibliography 554 Appendix A Term Project: Osric's Office Appliances and Decor 579 Appendix B Software Engineering Resources 583 Appendix C * Requirements Workflow: The MSG Foundation Case Study 585 Appendix D Structured Systems Analysis: The MSG Foundation Case Study 586 Appendix E Analysis Workflow: The MSG Foundation Case Study 589 Appendix F Software Project Management Plan: The MSG Foundation Case Study 590 Appendix G Design Workflow: The MSG Foundation Case Study 595 Appendix H Implementation Workflow: The MSG Foundation Case Study (C++ Version) 600 Appendix I Implementation Workflow: The MSG Foundation Case Study (Java Version) 601 Appendix J Test Workflow: The MSG Foundation Case Study 602 Author Index 603 Subject Index 606