Java Reference
In-Depth Information
Display 12.1
A UML Class Diagram
Square
— side: double
— xCoordinate: double
— yCoordinate: double
+ resize( double newSide): void
+ move( double newX, double newY): void
# erase(): void
. . .
Class Interactions
Class diagrams by themselves are of little value, because they simply repeat the
class interface, possibly with ellipses. To understand a design, you need to indicate
how objects of the various classes interact. UML has various ways to indicate class
interactions; for example, various sorts of annotated arrows indicate the information
flow from one class object to another. UML also has annotations for class groupings
into packages, annotations for inheritance, and annotations for other interactions.
Moreover, UML is extensible. If what you want and need is not in UML, you
can add it. Of course, this all takes place inside a prescribed framework so that
different software developers can understand each other's UML. One of the most
fundamental of class interactions is inheritance, which is discussed in the next
subsection.
Inheritance Diagrams
Display 12.2 shows a possible inheritance diagram used in a university's
record-keeping software for some of its classes. Note that the class diagrams are
incomplete. You normally show only as much of the class diagram as you need for
the design task at hand. Note that the arrow heads point up from a derived class
to its base class. In UML an unfilled arrowhead is used to indicate an inheritance
relationship between two classes.
The arrows also help in locating method definitions. If you are looking for a method
definition for some class, the arrows show the path you (or the computer) should
follow. If you are looking for the definition of a method used by an object of the class
Undergraduate , first look in the definition of the class Undergraduate ; if it is not
there, look in the definition of Student ; if it is not there, look in the definition of the
class Person .
inheritance
diagram
arrows
 
 
Search WWH ::




Custom Search