Class 2 |
Intermediate Java 30-IT-397 |
|
Decorating your Class Diagram
-
You can also assign visibility to the methods and attributes.
-
+ public
-
- private
-
# protected
-
You can also assign associations between classes.
-
A line without an arrowhead represents a role. Put the role description
above the line.
-
Use a darkened arrow to represent the direction of association. Put
the association above the line.
-
You normally have either an association or a role, but not both.
-
Multiplicity or cardinality notes the number of instances
of one class that are linked with one instance of another class.
-
Place the cardinality number towards the end of the association line of
the class to which you are describing.
-
Common cardinality includes: 1 (exactly one) 0..1 (0 or 1) 0..* (0 to many),
etc.
-
Composition and aggregation describes a strong relationship
between two classes. For the moment, let's ignore the differences
between the two.
-
For example, a car is composed of an engine. We can say that class
Car requires class Engine, the two cannot be separated to be functional.
-
To denote composition, use a diamond. Colored diamonds represent
composition, while hollow diamonds represent aggregation. But again,
for our purposes, this is not very significant.
-
Generalization represents inheritance. To denote generalization,
use an upward-pointing empty triangle on the superclass side of the association/role
line.
-
For example, Traditional and Pan extend Crust. On class Crust, you
would have an open triangle. This would be connected with a line
to classes Traditional and Pan.
Using Poseidon to Generate a Class Diagram

Created by: Brandan Jones
December 17, 2001