Cover image for Fundamentals of object-oriented design in UML
Title:
Fundamentals of object-oriented design in UML
Personal Author:
Publication Information:
Boston : Addison Wesley, 1999
ISBN:
9780201699463

Available:*

Library
Item Barcode
Call Number
Material Type
Item Category 1
Status
Searching...
30000004876821 QA78.64 P34 2000 Open Access Book Book
Searching...
Searching...
30000004876904 QA78.64 P34 2000 Open Access Book Book
Searching...
Searching...
30000004877142 QA78.64 P34 2000 Open Access Book Book
Searching...
Searching...
30000004877183 QA78.64 P34 2000 Open Access Book Book
Searching...

On Order

Summary

Summary

Object technology is increasingly recognized as a valuable tool in application development, but what is not yet recognized is the importance of design in the construction of robust and adaptable object-oriented (OO) applications. With the recent introduction and widespread adoption of the Unified Modeling Language (UML), programmers are now equipped with a powerful tool for expressing software designs. Fundamentals of Object-Oriented Design in UML shows aspiring and experienced programmers alike how to apply design concepts, the UML, and the best practices in OO development to improve both their code and their success rates with object-based projects. In the first two chapters, best-selling author Meilir Page-Jones introduces novices to key concepts and terminology, demystifying the jargon, and providing a context in which to view object orientation. Part II is a practical and well-illustrated guide to UML notation and to building the most useful UML diagrams. Part III grapples with advanced topics in the testing and improvement of design quality, including connascence, level-2 encapsulation, and the use of state-space and behavior to assess class hierarchies. These design principl


Author Notes

Meilir Page-Jones is President and Senior Consulting Methodologist at Wayland Systems.


Excerpts

Excerpts

"You say you want some evolution. Well, you know, I'm just doing what I can." -- Charles Darwin, On the Origin of Species People who reviewed this book in its draft form had several questions for me, questions that perhaps you share. Let me address some of them. I'm a programmer. Why should I care about design? Everyone who writes code also designs code -- either well or badly, either consciously or unconsciously. My goal in writing this book is to encourage people working in OO -- and their number increases annually - to create good object-oriented designs consciously and prior to coding. To this end, I introduce notation, principles and terminology that you and your colleagues can use to evaluate your designs and to discuss them meaningfully with one another. I'm not yet an OO programmer. Will this book teach me an OO programming language? No. Although I occasionally swoop down close to code, this isn't a book on object-oriented programming. But if I'm learning an object-oriented language, will this book help? Yes, it will. If you don't currently know an object-oriented programming language, you can begin your object-oriented knowledge with Chapter 1. Knowing the key concepts of object orientation will speed your learning an object-oriented language and, I hope, boost your morale as you move into unfamiliar territory. The later chapters of the book, on sound design, will also help you in getting your early programs to work successfully. On the other hand, if you're already an experienced object-oriented programmer, you can use Parts II and III of the book to enhance the design skills that are vital to your being a rounded, professional software designer or programmer. Why aren't the code examples in this book in C++? I've written the code in this book in a language of my own devising, which is a blend of four popular languages: C++, Eiffel, Java and Smalltalk. I did this because there are two kinds of programmers: those who are fluent in C++ and those who aren't. If you're a C++ aficionado, then you'll find the code a breeze to translate into C++. If you're not familiar with C++, then you might have found the language's arcane syntax getting in the way of the examples. I'd like you to feel welcome in this book whatever your programming language might be. However, there is a fragment of Java in this book. I used Java because it's more accessible to a non-Java programmer than C++ is to a non-C++ programmer. Why isn't this book devoted to the design of windows, icons and menus? There are two reasons: First, I don't believe that object orientation is useful only for the design of graphical user interfaces. Second, there are many books on the market devoted solely to the topic of object-oriented window design. I want this book to cover topics that are not well covered by the other object-oriented books on the market. However, in Chapter 7 I offer some notation for window-navigation design. Is this book about a methodology? No. As you know, a development methodology contains much more than design. For example, there's requirements analysis, library management and so on. Also, a true methodology needs to explain how the various development activities fit together. A lot of stuff! So, instead of turning out a book as diffuse as many other books on object orientation, I decided to focus on a single topic: object-oriented design. You've said a lot about what this book isn't about. What is it about? It's about the fundamental ideas, notation, terminology, criteria and principles of object-oriented software design. Object-oriented software is software that comprises objects and the classes to which they belong. An object is a component in which methods (which are like functions or procedures) are organized around a set of variables (which are like data). A class implements a type defining the group of objects that belong to that class. The above modest sentences hold some surprising implications for software designers and programmers, implications that arise from the design concepts of inheritance, polymorphism and second-order design. But, since you asked a specific question, let me give you a specific answer. Part I of the book (Chapters 1-2) provides an introduction to object orientation. Chapter 1 summarizes the key concepts and demystifies "polymorphism," "genericity," and all the other OO jargon. Chapter 2 sets object orientation into the framework of previous developments in software. If you're already familiar with object orientation (perhaps by having programmed in an object-oriented language), then you can skip or skim Part I. Part II (Chapters 3-7) covers the Unified Modeling Language (UML), which has become the de facto standard notation for depicting object-oriented design. In passing, Part II also illustrates many of the structures that you find in object-oriented systems. Chapter 3 introduces the UML for depicting classes, along with their attributes and operations. Chapter 4 covers UML for hierarchies of subclasses and superclasses, associations, and aggregate and composite objects. Chapter 5 sets out UML for messages (both sequential and asynchronous), while Chapter 6 covers UML for state diagrams. Chapter 7 reviews UML for system architecture and the windows that form a human interface. Part III (Chapters 8-14) covers object-oriented design principles in some depth. Chapter 8 sets the scene with the crucial notions of connascence and level-2 encapsulation. Chapter 9 explores the various domains that "classes come from" and describes different degrees of class cohesion. Chapters 10 and 11 form the central pillar of Part III, using the concepts of state-space and behavior to assess when a class hierarchy is both sound and extendible. Chapter 12 offers some light relief, as it examines designs taken from real projects, including both the subtle and the absurd. (Chapter 12 is really about the dangers of abusing inheritance and polymorphism.) Chapter 13 looks at some ways of organizing operations within a given class, and explains design techniques such as mix-in classes and operation rings that will improve class reusability and maintainability. Chapter 14 rounds off the book by taking a stab at the old question: "What makes a good class?" In answering this question, Chapter 14 describes the various kinds of class interface, ranging from the horrid to the sublime. A class with an exemplary interface will be a worthy implementation of an abstract data-type. If the class also obeys the fundamental principles laid out in earlier chapters, then it will be as robust, reliable, extensible, reusable and maintainable as a class can ever be. Chapter 15 traces the development of an object-oriented component for a business application. In following the component's construction, I recall some of the object-oriented principles of the previous chapters. Although I've added plenty of examples, diagrams and exercises to reinforce what I say in the main text, I must admit that the material in Part III gets tough at times. Nevertheless, I decided not to trivialize or dilute important issues. Some aspects of object-oriented design are difficult and to suggest otherwise would be to patronize you. Anyway, I know you can take it! Does this book cover everything in object-oriented design? I very much doubt it. Each day, I learn more about object orientation, and I'm sure you do too. Indeed, it would be a dull world if a single book could tell us everything about object-oriented design and leave us with nothing more to learn. And everything in this book may not be completely true! I certainly changed my mind about one or two things after I wrote my previous books, as I became older and wiser -- well older, anyway. So, although I think that I've covered many important design principles in this book, if you're serious about object orientation you should continue to read as much as you can and always challenge what you read. Do you offer courses on object-oriented design? Yes, we offer several courses on object-oriented topics. Our curriculum continually changes, so check out www.waysys.com for our latest offerings. Bottom-line, as they say: Is this book for me? What kind of question is that? You expect me to say "No!"? But seriously, folks, this book's for you if you are -- or are about to become -- a programmer, designer, systems engineer or technical manager on a project using object-oriented techniques. Even if you're a beginner to object orientation, you can glean a lot from this book by reading Part I, practicing some object-oriented programming and then returning to Parts II and III. You should also read this book if you're a university student or professional programmer who has mastered the techniques of standard procedural programming and is looking for wider horizons. Much of the book's material is suitable for a final-year computer-science or software-engineering course in object orientation. But, whatever your role in life, I hope that you enjoy this book and find it useful. Good luck! Meilir Page-Jones meilir@waysys.com Bellevue, Washington July 1999 020169946XP04062001 Excerpted from Fundamentals of Object-Oriented Design in UML by Meilir Page-Jones All rights reserved by the original copyright owners. Excerpts are provided for display purposes only and may not be reproduced, reprinted or distributed without the written permission of the publisher.

Table of Contents

Forewordp. xv
Prefacep. xvii
Part I Introductionp. 1
Chapter 1 What Does It Mean to Be Object Oriented, Anyway?p. 3
1.1 Encapsulationp. 9
1.2 Information/Implementation Hidingp. 12
1.3 State Retentionp. 14
1.4 Object Identityp. 15
1.5 Messagesp. 19
1.5.1 Message structurep. 19
1.5.2 Message argumentsp. 21
1.5.3 The roles of objects in messagesp. 23
1.5.4 Types of messagep. 25
1.6 Classesp. 27
1.7 Inheritancep. 33
1.8 Polymorphismp. 38
1.9 Genericityp. 43
1.10 Summaryp. 48
1.11 Exercisesp. 50
1.12 Answersp. 52
Chapter 2 A Brief History of Object Orientationp. 57
2.1 Where Did Object Orientation Come From?p. 57
2.1.1 Larry Constantinep. 58
2.1.2 O.-J. Dahl and K. Nygaardp. 58
2.1.3 Alan Kay, Adele Goldberg, and othersp. 58
2.1.4 Edsger Dijkstrap. 58
2.1.5 Barbara Liskovp. 59
2.1.6 David Parnasp. 59
2.1.7 Jean Ichbiah and othersp. 59
2.1.8 Bjarne Stroustrupp. 59
2.1.9 Bertrand Meyerp. 60
2.1.10 Grady Booch, Ivar Jacobson, and Jim Rumbaughp. 60
2.2 Object Orientation Comes of Agep. 60
2.3 Object Orientation As an Engineering Disciplinep. 62
2.4 What's Object Orientation Good For?p. 64
2.4.1 Analyzing users' requirementsp. 65
2.4.2 Designing softwarep. 65
2.4.3 Constructing softwarep. 66
2.4.4 Maintaining softwarep. 69
2.4.5 Using softwarep. 69
2.4.6 Managing software projectsp. 70
2.5 Summaryp. 73
2.6 Exercisesp. 75
2.7 Answersp. 76
Part II The Unified Modeling Languagep. 77
Chapter 3 Basic Expression of Classes, Attributes, and Operationsp. 85
3.1 The Classp. 85
3.2 Attributesp. 87
3.3 Operationsp. 89
3.4 Overloaded Operationsp. 92
3.5 Visibility of Attributes and Operationsp. 93
3.6 Class Attributes and Operationsp. 94
3.7 Abstract Operations and Classesp. 95
3.8 The Utilityp. 97
3.9 Parameterized Classesp. 98
3.10 Summaryp. 100
3.11 Exercisesp. 102
3.12 Answersp. 103
Chapter 4 Class Diagramsp. 107
4.1 The Generalization Constructp. 108
4.1.1 Single inheritancep. 108
4.1.2 Multiple inheritancep. 110
4.1.3 Subclass partitioningp. 110
4.1.4 Partitioning discriminatorsp. 114
4.2 The Association Constructp. 115
4.2.1 The basic UML notation for associationsp. 116
4.2.2 Associations depicted as classesp. 119
4.2.3 Higher-order associationsp. 120
4.2.4 Navigability of associationsp. 122
4.3 Whole/Part Associationsp. 123
4.3.1 Compositionp. 123
4.3.2 Aggregationp. 126
4.4 Summaryp. 130
4.5 Exercisesp. 131
4.6 Answersp. 133
Chapter 5 Object-Interaction Diagramsp. 137
5.1 The Collaboration Diagramp. 138
5.1.1 Depicting a messagep. 139
5.1.2 Polymorphism in the collaboration diagramp. 142
5.1.3 Iterated messagesp. 143
5.1.4 Use of self in messagesp. 144
5.2 The Sequence Diagramp. 146
5.3 Asynchronous Messages and Concurrent Executionp. 149
5.3.1 Depicting an asynchronous messagep. 149
5.3.2 The callback mechanismp. 151
5.3.3 Asynchronous messages with priorityp. 155
5.3.4 Depicting a broadcast (nontargeted) messagep. 157
5.4 Summaryp. 159
5.5 Exercisesp. 161
5.6 Answersp. 162
Chapter 6 State Diagramsp. 164
6.1 Basic State Diagramsp. 165
6.2 Nested Statesp. 167
6.3 Concurrent States and Synchronizationp. 171
6.4 Transient States from Message-Result Argumentsp. 176
6.5 Continuously Variable Attributesp. 178
6.6 Summaryp. 180
6.7 Exercisesp. 182
6.8 Answersp. 184
Chapter 7 Architecture and Interface Diagramsp. 188
7.1 Depicting System Architecturep. 189
7.1.1 Packagesp. 189
7.1.2 Deployment diagrams for hardware artifactsp. 191
7.1.3 Deployment diagrams for software constructsp. 193
7.2 Depicting the Human Interfacep. 196
7.2.1 The window-layout diagramp. 196
7.2.2 The window-navigation diagramp. 198
7.2.3 A brief digression: What's object oriented about a GUI?p. 200
7.3 Summaryp. 202
7.4 Exercisesp. 203
7.5 Answersp. 204
Part III The Principles of Object-Oriented Designp. 207
Chapter 8 Encapsulation and Connascencep. 209
8.1 Encapsulation Structurep. 209
8.1.1 Levels of encapsulationp. 210
8.1.2 Design criteria governing interacting levels of encapsulationp. 212
8.2 Connascencep. 214
8.2.1 Varieties of connascencep. 214
8.2.2 Contranascencep. 220
8.2.3 Connascence and encapsulation boundariesp. 221
8.2.4 Connascence and maintainabilityp. 222
8.2.5 Connascence abuses in object-oriented systemsp. 224
8.2.6 The term connascencep. 227
8.3 Summaryp. 228
8.4 Exercisesp. 230
8.5 Answersp. 231
Chapter 9 Domains, Encumbrance, and Cohesionp. 233
9.1 Domains of Object Classesp. 234
9.1.1 The foundation domainp. 235
9.1.2 The architecture domainp. 235
9.1.3 The business domainp. 236
9.1.4 The application domainp. 237
9.1.5 The source of classes in each domainp. 238
9.2 Encumbrancep. 241
9.2.1 What is encumbrance?p. 241
9.2.2 The use of encumbrancep. 244
9.2.3 The Law of Demeterp. 244
9.3 Class Cohesion: A Class and Its Featuresp. 246
9.3.1 Mixed-instance cohesionp. 247
9.3.2 Mixed-domain cohesionp. 248
9.3.3 Mixed-role cohesionp. 250
9.4 Summaryp. 253
9.5 Exercisesp. 254
9.6 Answersp. 255
Chapter 10 State-Space and Behaviorp. 259
10.1 State-Space and Behavior of a Classp. 259
10.2 The State-Space of a Subclassp. 263
10.3 The Behavior of a Subclassp. 266
10.4 The Class Invariant as a Restriction on a State-Spacep. 267
10.5 Preconditions and Postconditionsp. 269
10.6 Summaryp. 272
10.7 Exercisesp. 273
10.8 Answersp. 274
Chapter 11 Type Conformance and Closed Behaviorp. 278
11.1 Class versus Typep. 279
11.2 The Principle of Type Conformancep. 281
11.2.1 The principles of contravariance and covariancep. 282
11.2.2 An example of contravariance and covariancep. 283
11.2.3 A graphic illustration of contravariance and covariancep. 288
11.2.4 A summary of the requirements for type conformancep. 290
11.3 The Principle of Closed Behaviorp. 291
11.4 Summaryp. 294
11.2 Exercisesp. 295
11.6 Answersp. 296
Chapter 12 The Perils of Inheritance and Polymorphismp. 299
12.1 Abuses of Inheritancep. 299
12.1.1 Mistaken aggregatesp. 300
12.1.2 Inverted hierarchyp. 301
12.1.3 Confusing class and instancep. 302
12.1.4 Misapplying is ap. 306
12.2 The Danger of Polymorphismp. 309
12.2.1 Polymorphism of operationsp. 309
12.2.2 Polymorphism of variablesp. 312
12.2.3 Polymorphism in messagesp. 314
12.2.4 Polymorphism and genericityp. 316
12.3 Summaryp. 319
12.4 Exercisesp. 320
12.5 Answersp. 322
Chapter 13 Techniques for Organizing Operationsp. 327
13.1 Mix-In Classesp. 327
13.1.1 A business examplep. 328
13.1.2 A graphics examplep. 333
13.2 Rings of Operationsp. 336
13.3 Summaryp. 342
13.4 Exercisesp. 343
13.5 Answersp. 344
Chapter 14 Class Cohesion and Support of States and Behaviorp. 349
14.1 State Support in a Class Interfacep. 350
14.2 Behavior Support in a Class Interfacep. 352
14.3 Operation Cohesion in a Class Interfacep. 360
14.4 Summaryp. 364
14.5 Exercisesp. 366
14.6 Answersp. 371
Chapter 15 Designing a Software Componentp. 377
15.1 What Is a Component?p. 378
15.2 Similarities and Differences Between Components and Objectsp. 380
15.3 Example of a Componentp. 382
15.4 Internal Design of a Componentp. 389
15.5 Lightweight and Heavyweight Componentsp. 397
15.6 Advantages and Disadvantages of Using Componentsp. 400
15.7 Summaryp. 406
15.8 Exercisesp. 408
15.9 Answersp. 409
Appendix A Checklist for an Object-Oriented Design Walkthroughp. 411
Appendix B The Object-Oriented Design Owner's Manualp. 417
Appendix C The Blitz Guide to Object-Oriented Terminologyp. 423
Glossaryp. 425
Bibliographyp. 443
Indexp. 451