Object-Oriented Design Peter Coad and Edward Yourdon Technische Hochschule Darmstadt FACHBKREICH INFORMATIK BIBLIOTHEK Inventar-Nr.:...A.Q.HA&. Sachg biete:.../??/.4, Standort: YOURQDN PRESS PRENTICE HALL BUILDING ENGLEWOOD CLIFFS, NJ 07632
Contents Preface Acknowledgments 0 Introduction 0.1 0.2 0.3 History Method and Tool Future Advances 1 Improving Design 1.1 1.2 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.3 1.3.1 1.3.2 1.4 1.4.1 1.4.2 1.4.3 1.5 Basic Terminology Principles for Managing Complexity Abstraction Encapsulation Inheritance Association Communication with Messages Pervading Methods of Organization Scale Behavior Classification OOD and the Impact of Prototyping Reasons for Prototyping Advice^ for OOD Prototyping The Key Objectives of OOD Improve Productivity Increase Quality Elevate Maintainability Motivations and Benefits of OOD 2 Developing the Multilayer, Multicomponent Model 2.1 2.2 2.2.1 2.2.2 2.2.3 2.3 2.4 Discovering a Model A Continuum of Representation The Problem A Solution Some Major Implications Five Layers, Five Activities Four Components, Four Activities xiii XV l 2 3 3 4 4 6 6 7 7 8 8 8 9 9 10 10 12 14 14 15 15 17 18 19 20 20 21 21 24 25 vii
viii Contents 2.5 Definitions and Notations 26 2.5.1 Definitions and Notations Class-&-Object 26 2.5.2 Definitions and Notations Structure 28 2.5.3 Definitions and Notations Subject 30 2.5.4 Notation Attribute (and Instance Connection) 32 2.5.5 Notation Service (and Message Connection) 33 2.5.6 Notation Summary 34 3 Designing the Problem Domain Component 36 3.1 What Problem Domain Component 36 3.1.1 The Approach What It Is Not 36 3.1.2 The Approach What It Is 36 3.2 Why Problem Domain Component 37 3.3 How Problem Domain Component 37 3.3.1 Apply OOA 38 3.3.2 Use OOA Results and Improve Them 38 3.3.3 Use OOA Results and Add to Them 39 3.3.4 Example Sensor Monitoring System 51 3.3.5 Example OOA Tool 53 4 Designing the Human Interaction Component 56 4.1 What Human Interaction Component 56 4.2 Why Human Interaction Component 56 4.3 How Human Interaction Component 57 4.3.1 Classify the Humans 57 4.3.2 Describe the Humans and Their Task Scenarios 58 4.3.3 Design the Command Hierarchy 60 4.3.4 Design the Detailed Interaction. 63 4.3.5 Continue to Prototype 64 4.3.6 Design the HIC Classes 65 4.3.7 Design, Accounting for Graphical User Interfaces 67 4.3.8 Example Sensor Monitoring System 68 4.3.9 Example OOA Tool 70 5 Designing the Task Management Component 72 5.1 What Task Management Component 72 5.2 Why Task Management Component 73 5.3 How Task Management Component 73 5.3.1 Identify Event-Driven Tasks 74 5.3.2 Identify Clock-Driven Tasks 74
Contents ix 5.3.3 Identify priority Tasks and Critical Tasks 74 5.3.4 Identify a Coordinator 75 5.3.5 Challenge Each Task 75 5.3.6 Define Each Task 76 5.3.7 Example-Sensor Monitoring System 78 5.3.8 Example OOA Tool 79 6 Designing the Data Management Component 80 6.1 What Data Management Component 80 6.2 Why Data Management Component 80 6.3 How Data Management Component 80 6.3.1 Data Management Approaches 80 6.3.2 Assessing Data Management Tools 83 6.3.3 Designing the Data Management Component 84 6.3.4 Example Sensor Monitoring System 86 6.3.5 Example OOA Tool 87 7 Applying OOD with OOPLs (or Less Than an OOPL) 89 7.1 Being Utterly Pragmatic about Languages 89 7.2 The Language Impact on OO Development 89 7.3 Evaluating Language Syntax and Features 91 7.3.1 Evaluation Criteria 91 7.3.2 Syntax and Features C++ and Object Pascal 92 7.3.3 Syntax and Features Smalltalk and Objective-C 102 7.3.4 Syntax and Features Eiffel 110 7.3.5 Syntax and Features Ada 115 7.3.6 Syntax and Features Procedural Languages 120 7.4 Selecting OOPLs 124 7.4.1 Which OOPLs Will Dominate? 124 7.4.2 Reusability across OOA to OOD to OOPLs 124 7.4.3 Class Library and Development Environment 124 7.4.4 Other Issues 125 8 Applying OOD Criteria 126 8.1 Introduction: What and Why 126 8.2 Coupling 129 8.2.1 Interaction Coupling 130 8.2.2 Inheritance Coupling 132 8.3 Cohesion 134 8.3.1 Service Cohesion 134
x Contents 8.3.2 8.3.3 8.4 8.4.1 8.4.2 8.4.3 8.4.5 8.5 8.5.1 8.5.2 8.5.3 8.5.4 8.5.5 8.5.6 8.5.7 8.5.8 8.5.9 8.5.10 8.6 Class Cohesion Generalization-Specialization Cohesion Reuse Why Does It Matter Why Aren't People Doing It? Levels of Reusability Organizational Approaches to Reusability Additional Criteria Clarity of Design Generalization-Specialization Depth Keeping Objects and Classes Simple Keeping Protocols Simple Keeping Services Simple Minimizing Design Volatility Minimizing Overall System Size Ability to "Evaluate by Scenario" Evaluation by "Critical Success Factors" Recognized Elegance in the Design Final Comments 9 Selecting CASE for OOD 9.1 9.2 9.2.1 9.2.2 9.2.3 9.2.4 9.2.5 9.2.6 9.3 9.4 Expanding Case What's Needed for OOD Notation Layers Components Auto-Tracking Features Advanced Features Model Checks What's Available Additional Considerations 10 Getting Started with OOD 10.1 10.2 10.2.1 10.2.2 Another Silver Bullet? Is this the Time to Start Using OOD? Is the Object-Oriented Paradigm Mature? Is There a Good Obiect-Oriented 134 135 136 136 137 138 140 141 141 143 144 145 145 146 146 147 147 148 148 149 149 149 150 150 150 151 151 151 152 153 154 154 154 156 156 Implementation Technology? 10.2.3 Is the Development Organization 157 Sophisticated Enough?
Contents xi 10.2.4 Is the Organization Building Systems That 158 Will Exploit Object-Oriented Techniques? 10.3 Revolution Versus Evolution 159 10.4 How to Get Started with OOD 160 10.5 Conclusion 161 A OOA/OOD Notation Summary 162 B OOA Strategy Summary 164 C OOD Strategy Summary 171 Bibliography 182 Index 190