Part Ⅰ Introduction 1
Chapter 1 What Does It Mean to Be Object Oriented,Anyway? 3
1.1 Encapsulation 9
1.2 Information/Implementation Hiding 12
1.3 State Retention 14
1.4 Object Identity 15
1.5 Messages 19
1.5.1 Message structure 19
1.5.2 Message arguments 21
1.5.3 The roles of objects in messages 23
1.5.4 Types of message 25
1.6 Classes 27
1.7 Inheritance 33
1.8 Polymorphism 38
1.9 Genericity 43
1.10 Summary 48
1.11 Exercises 50
1.12 Answers 52
Chapter 2 A Brief History of Object Orientation 57
2.1 Where Did Object Orientation Come From? 57
2.1.1 Larry Constantine 58
2.1.2 O.-J.Dahl and K.Nygaard 58
2.1.3 Alan Kay,Adele Goldberg,and others 58
2.1.4 Edsger Dijkstra 58
2.1.8 Bjarne Stroustrup 59
2.1.7 Jean Ichbiah and others 59
2.1.5 Barbara Liskov 59
2.1.6 David Parnas 59
2.1.9 Bertrand Meyer 60
2.1.10 Grady Booch,Ivar Jacobson,and Jim Rumbaugh 60
2.2 Object Orientation Comes of Age 60
2.3 Object Orientation As an Engineering Discipline 62
2.4 What's Object Orientation Good For? 64
2.4.1 Analyzing users'requirements 65
2.4.2 Designing software 65
2.4.3 Constructing software 66
2.4.4 Maintaining software 69
2.4.5 Using software 69
2.4.6 Managing software projects 70
2.5 Summary 73
2.6 Exercises 75
2.7 Answers 76
Part Ⅱ The Unified Modeling Language 77
Chapter 3 Basic Expression of Classes,Attributes,andOperations 85
3.1 The Class 85
3.2 Attributes 87
3.3 Operations 89
3.4 Overloaded Operations 92
3.5 Visibility of Attributes and Operations 93
3.6 Class Attributes and Operations 94
3.7 Abstract Operations and Classes 95
3.8 The Utility 97
3.9 Parameterized Classes 98
3.10 Summary 100
3.11 Exercises 102
3.12 Answers 103
Chapter 4 Class Diagrams 107
4.1 The Generalization Construct 108
4.1.1 Single inheritance 108
4.1.2 Multiple inheritance 110
4.1.3 Subclass partitioning 110
4.1.4 Partitioning discriminators 114
4.2 The Association Construct 115
4.2.1 The basic UML notation for associations 116
4.2.2 Associations depicted as classes 119
4.2.3 Higher-order associations 120
4.2.4 Navigability of associations 122
4.3 Whole/Part Associations 123
4.3.1 Composition 123
4.3.2 Aggregation 126
4.4 Summary 130
4.5 Exercises 131
4.6 Answers 133
Chapter 5 Object-Interaction Diagrams 137
5.1 The Collaboration Diagram 138
5.1.1 Depicting a message 139
5.1.2 Polymorphism in the collaboration diagram 142
5.1.3 Iterated messages 143
5.1.4 Use of self in messages 144
5.2 The Sequence Diagram 146
5.3 Asynchronous Messages and Concurrent Execution 149
5.3.1 Depicting an asynchronous message 149
5.3.2 The callback mechanism 151
5.3.3 Asynchronous messages with priority 155
5.3.4 Depicting a broadcast(nontargeted)message 157
5.4 Summary 159
5.5 Exercises 161
5.6 Answers 162
Chapter 6 State Diagrams 164
6.1 Basic State Diagrams 165
6.2 Nested States 167
6.3 Concurrent States and Synchronization 171
6.4 Transient States from Message-Result Arguments 176
6.5 Continuously Variable Attributes 178
6.6 Summary 180
6.7 Exercises 182
6.8 Answers 184
Chapter 7 Architecture and Interface Diagrams 188
7.1 Depicting System Architecture 189
7.1.1 Packages 189
7.1.2 Deployment diagrams for hardware artifacts 191
7.1.3 Deployment diagrams for software constructs 193
7.2.1 The window-layout diagram 196
7.2 Depicting the Human Interface 196
7.2.2 The window-navigation diagram 198
7.2.3 A brief digression:What's object oriented about a GUI? 200
7.3 Summary 202
7.4 Exercises 203
7.5 Answers 204
Part Ⅲ The Principles of Object-Oriented Design 207
Chapter 8 Encapsulation and Connascence 209
8.1 Encapsulation Structure 209
8.1.1 Levels of encapsulation 210
8.1.2 Design criteria governing interacting levels of encapsulation 212
8.2.1 Varieties of connascence 214
8.2 Connascence 214
8.2.2 Contranascence 220
8.2.3 Connascence and encapsulation boundaries 221
8.2.4 Connascence and maintainability 222
8.2.5 Connascence abuses in object-oriented systems 224
8.2.6 The term connascence 227
8.3 Summary 228
8.4 Exercises 230
8.5 Answers 231
Chapter 9 Domains,Encumbrance,and Cohesion 233
9.1 Domains of Object Classes 234
9.1.1 The foundation domain 235
9.1.2 The architecture domain 235
9.1.3 The business domain 236
9.1.4 The application domain 237
9.1.5 The source of classes in each domain 238
9.2 Encumbrance 241
9.2.1 What is encumbrance? 241
9.2.2 The use of encumbrance 244
9.2.3 The Law of Demeter 244
9.3 Class Cohesion:A Class and Its Features 246
9.3.1 Mixed-instance cohesion 247
9.3.2 Mixed-domain cohesion 248
9.3.3 Mixed-role cohesion 250
9.4 Summary 253
9.5 Exercises 254
9.6 Answers 255
Chapter 10 State-Space and Behavior 259
10.1 State-Space and Behavior of a Class 259
10.2 The State-Space of a Subclass 263
10.3 The Behavior of a Subclass 266
10.4 The Class Invariant as a Restriction on a State-Space 267
10.5 Preconditions and Postconditions 269
10.6 Summary 272
10.7 Exercises 273
10.8 Answers 274
Chapter 11 Type Conformance and Closed Behavior 278
11.1 Class versus Type 279
11.2 The Principle of Type Conformance 281
11.2.1 The principles of contravariance and covariance 282
11.2.2 An example of contravariance and covariance 283
11.2.3 A graphic illustration of contravariance and covariance 288
11.2.4 A summary of the requirements for type conformance 290
11.3 The Principle of Closed Behavior 291
11.4 Summary 294
11.5 Exercises 295
11.6 Answers 296
Chapter 12 The Perils of Inheritance and Polymorphism 299
12.1 Abuses of Inheritance 299
12.1.1 Mistaken aggregates 300
12.1.2 Inverted hierarchy 301
12.1.3 Confusing class and instance 302
12.1.4 Misapplying is a 306
12.2 The Danger of Polymorphism 309
12.2.1 Polymorphism of operations 309
12.2.2 Polymorphism of variables 312
12.2.3 Polymorphism in messages 314
12.2.4 Polymorphism and genericity 316
12.3 Summary 319
12.4 Exercises 320
12.5 Answers 322
Chapter 13 Techniques for Organizing Operations 327
13.1 Mix-In Classes 327
13.1.1 A business example 328
13.1.2 Agraphics example 333
13.2 Rings of Operations 336
13.3 Summary 342
13.4 Exercises 343
13.5 Answers 344
Chapter 14 Class Cohesion and Support of States andBehavior 349
14.1 State Support in a Class Interface 350
14.2 Behavior Support in a Class Interface 352
14.3 Operation Cohesion in a Class Interface 360
14.4 Summary 364
14.5 Exercises 366
14.5 Answers 371
Chapter 15 Designing a Software Component 377
15.1 What Is a Component? 378
15.2 Similarities and Differences Between Components and Objects 380
15.3 Example of a Component 382
15.4 Internal Design of a Component 389
15.5 Lightweight and Heavyweight Components 397
15.6 Advantages and Disadvantages of Using Components 400
15.7 Summary 406
15.8 Exercises 408
15.9 Answers 409
Appendix A:Checklist for an Object-Oriented Design Walkthrough 411
Appendix B:The Object-Oriented Design Owner's Manual 417
Appendix C:The Blitz Guide to Object-Oriented Terminology 423
Glossary 425
Bibliography 443
Index 451