|
Foreword xv
Preface xvii
Part I Introduction 1
Chapter 1 What Does It Mean to Be Object-Oriented,
Anyway? 3
1.1 Encapsulation 9
1.2 Information/Implementation Hiding 11
1.3 State Retention 13
1.4 Object Identity 14
1.5 Messages 18
1.5.1 Message structure 18
1.5.2 Message arguments 19
1.5.3 The roles of objects in messages 21
1.5.4 Types of message 22
1.6 Classes 24
1.7 Inheritance 29
1.8 Polymorphism 34
1.9 Genericity 39
1.10 Summary 44
1.11 Exercises 46
1.12 Answers 48
Chapter 2 Object-Orientation-Who Ordered That?
51
2.1 Where Did Object Orientation Come From?
51
2.1.1 Larry Constantine 52
2.1.2 O.-J. Dahl and K. Nygaard 52
2.1.3 Alan Kay, Adele Goldberg, and others
52
2.1.4 Edsger Dijkstra 52
2.1.5 Barbara Liskov 53
2.1.6 David Parnas 53
2.1.7 Jean Ichbiah and others 53
2.1.8 Bjarne Stroustrup 53
2.1.9 Bertrand Meyer 54
2.2 Object Orientation in a Social Context
54
2.2.1 The history of the mainstream 54
2.2.2 To the barricades: the object-oriented
revolutionaries 55
2.2.3 Forward to the past: the object-oriented
reactionaries 56
2.2.4 Enter the evolutionists (stage middle)
56
2.3 Object Orientation As an Engineering Discipline
59
2.4 What's Object Orientation Good For? 60
2.4.1 Analyzing users' requirements 61
2.4.2 Designing software 61
2.4.3 Constructing software 62
2.4.4 Maintaining software 63
2.4.5 Using software 64
2.4.6 Managing software projects 65
2.5 Summary 66
2.6 Exercises 68
2.7 Answers 69
Part II Object-Oriented Design Notation 71
Chapter 3 The Basic Notation for Classes and
Methods 75
3.1 The Goals of OODN 75
3.2 The Class Symbol 78
3.3 Modifier and Accessor Methods 78
3.4 The Class-External-Interface Diagram 79
3.5 Function-Style Methods 81
3.6 Overloaded Methods 84
3.7 Further Notation for Methods 85
3.8 The Package 88
3.9 The Class-Internal-Design Diagram 89
3.10 Summary 92
3.11 Exercises 93
3.12 Answers 94
Chapter 4 Inheritance and Aggregation Diagrams
97
4.1 The Class-Inheritance Diagram 97
4.2 Aggregate Objects and Their Components 100
4.2.1 The object-aggregation diagram 100
4.2.2 Aggregate objects with generic classes
in their components 103
4.3 Summary 106
4.4 Exercises 107
4.5 Answers 108
Chapter 5 The Object-Communication Diagram 111
5.1 Synchronous Messaging 111
5.1.1 Depicting a synchronous message
112
5.1.2 Polymorphism in the object-communication
diagram 115
5.1.3 Iterated messages 116
5.1.4 Use of self in messages 118
5.1.5 Messages that result in exceptions 120
5.2 Asynchronous Messaging and Concurrent Execution
121
5.2.1 Depicting an asynchronous message
123
5.2.2 Depicting a target object's capability
to receive multiple messages 125
5.2.3 Depicting a target object's capability
to process multiple messages concurrently
126
5.2.4 Depicting a broadcast (nontargeted)
message 129
5.2.5 Depicting other mechanisms to support
concurrency 130
5.2.6 Object-interaction/timing diagrams 131
5.3 Summary 135
5.4 Exercises 136
5.5 Answers 137
Chapter 6 State-Transition Diagrams 140
6.1 Basic State-Transition Diagrams 140
6.2 Nested States 142
6.3 Message Arguments 145
6.4 Continuous Variables 148
6.5 State Definitions 149
6.6 Summary 151
6.7 Exercises 152
6.8 Answers 153
Chapter 7 Additional OODN Diagrams 155
7.1 Depicting Database Access 155
7.1.1 Persistence 156
7.1.2 Navigational and scanning queries 157
7.1.3 Access to data files 160
7.1.4 Class migration 161
7.2 Depicting System Architecture 162
7.3 Depicting the Human Interface 166
7.4 Summary 170
7.5 Exercises 171
7.6 Answers 173
Part III The Principles of Object-Oriented Design
177
Chapter 8 Encapsulation and Connascence 179
8.1 Encapsulation Structure 179
8.1.1 Levels of encapsulation 180
8.1.2 Design criteria governing interacting
levels of encapsulation 181
8.2 Connascence 183
8.2.1 Varieties of connascence 183
8.2.2 Contranascence 188
8.2.3 Connascence and encapsulation boundaries
189
8.2.4 Connascence and maintainability 190
8.2.5 Connascence abuses in object-oriented
systems 192
8.3 Summary 196
8.4 Exercises 197
8.5 Answers 198
Chapter 9 Domains, Encumbrance, and Cohesion
200
9.1 Domains of Object Classes 200
9.1.1 The foundation domain 201
9.1.2 The architectural domain 202
9.1.3 The business domain 203
9.1.4 The application domain 204
9.1.5 The source of classes in each domain
205
9.2 Encumbrance 207
9.2.1 Definition of encumbrance 207
9.2.2 The use of encumbrance 210
9.2.3 The Law of Demeter 211
9.3 Class Cohesion: A Class and Its Methods
212
9.3.1 Mixed-instance cohesion 213
9.3.2 Mixed-domain cohesion 214
9.3.3 Mixed-role cohesion 217
9.4 Summary 219
9.5 Exercises 220
9.6 Answers 221
Chapter 10 Properties of Classes and Subclasses
225
10.1 State-Space and Behavior of a Class 226
10.2 The State-Space of a Subclass 229
10.3 The Behavior of a Subclass 231
10.4 The Class Invariant As a Restriction on
a State-Space 233
10.5 Preconditions and Postconditions 236
10.6 The Principle of Type Conformance 238
10.7 Subclasses As Subtypes 240
10.8 The Principle of Closed Behavior 247
10.9 Summary 250
10.10 Exercises 252
10.11 Answers 254
Chapter 11 The Perils of Inheritance and Polymorphism
259
11.1 Abuses of Inheritance 260
11.1.1 Mistaken aggregates 260
11.1.2 Inverted hierarchy 262
11.1.3 Confusing class and instance 263
11.1.4 Misapplying is a 265
11.2 The Danger of Polymorphism 269
11.2.1 Polymorphism in messages 269
11.2.2 Polymorphism and genericity 275
11.3 Summary 279
11.4 Exercises 280
11.5 Answers 282
Chapter 12 Class Interfaces 285
12.1 Mix-In Classes 286
12.2 Rings of Methods 289
12.3 Quality of a Class Interface 293
12.3.1 State support in a class interface
294
12.3.2 Behavior support in a class interface
296
12.3.3 Method cohesion in a class interface
303
12.4 Summary 307
12.5 Exercises 309
12.6 Answers 315
Appendix A: Checklist for an Object-Oriented
Design Walkthrough 325
Appendix B: The Object-Oriented Design
Owner's Manual 331
Appendix C: Blitz Guide to Object-Oriented
Terminology 337
Glossary 339
Bibliography 357
Index 363
Return to Book Page
|