Chapter 14: Modeling Diagrams for OO Programs


OVERVIEW

So far in this book, for the most part we have focused on OO syntax at the level of a single class. We are now ready to dig into more advanced topics such as class derivation, multiple inheritance, multithreading, graphics programming, and so on. But before we get into these subjects, it would be useful to review the tools for creating visual representations of object—oriented programs that show the classes and their interactions in different ways. Obviously, if you are extending a class, it is because you believe that your program needs a concept that is an extension of a previously codified concept. Given multiple such concepts that are related to one another either through inheritance or otherwise, it can be difficult to keep in one' mental perspective a top—level view of all the interclass relationships. Visual representations can be of great help in such cases.

Making visual representations of classes can also aid the process of giving object orientation to a new problem domain—a process that is often more difficult than it appears at first sight. Object orientation of a nontrivial problem domain is usually a result of analytical thinking if you are yourself a domain expert, or analytical discourse with the domain experts. But analytical thinking does not result in the conceptualization of all the needed classes and their interrelationships in one fell swoop. Rather, one proceeds in an incremental and iterative fashion in which one starts with a set of classes that one believes would deliver the basic functionality expected of the software and then adds or subtracts from this set as one' understanding of the problem domain deepens. Visual representations of this evolving set of classes are evidently of great help for maintaining a mental perspective on the software, its evolution, and its dissemination to others.

Over the years, various tools have been proposed for creating visual representations of classes and their behaviors. More recently, many of these tools have been pulled together by the Object Management Group, a not—for—profit organization founded by the leading software corporations of the world for the standardization of object—based software development tools. One of the principal tools that has resulted from this activity is the Unified Modeling Language (UML). UML can be used to enhance one' productivity in literally every phase of OO software development—from the recording of initial thoughts about the central concepts in a new problem domain (using class and activity diagrams), to organizing one' communication with the domain expert (with the help of use cases), to graphical documentation of the final software product, and so on.

This chapter provides a quick review of the different types of UML—based modeling diagrams that are possible for object—oriented programs. The different types of diagrams portray different aspects of a program. For example, a class diagram is commonly used to display the main concepts of an OO program and their relationships. On the other hand, if you need to portray the functionality of an OO program, you would use a use—case diagram. To get a better understanding of the time—dependencies of the interaction between classes as they collaborate to achieve a certain functionality, you would use an interaction diagram. If you need a visual representation to show the different states of a particular object and how the object transitions from state to state, you would use a statechart diagram. You would use an activity diagram to highlight those portions of program execution that can be carried out in parallel and those that must be carried out sequentially. And, finally, if you modularize your software—as you invariably would if the software is large—you would use a package diagram to show the dependencies between the different modules.




Programming With Objects[c] A Comparative Presentation of Object-Oriented Programming With C++ and Java
Programming with Objects: A Comparative Presentation of Object Oriented Programming with C++ and Java
ISBN: 0471268526
EAN: 2147483647
Year: 2005
Pages: 273
Authors: Avinash Kak

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net