Class Diagram - Orange168/NotesOnReading GitHub Wiki
[TOC]
The Class Diagram
Basics
- Default value
name(parameter list) : type of value returned
- Visibility
Mark | Visbility Types |
---|---|
# | protected |
~ | package |
- | private |
+ | public |
Inheritance
Or using tree notation
Italicized indicates that BanckAccount is a abstract class, and withdrawal is abstract method
Associations
There are five types of associations.
- Bi-directional (standard) association
bi-directional; this means that both classes are aware of each other and their relationship
- Uni-directional association
In a uni-directional association, two classes are related, but only one class knows that the relationship exists.
- Association class
This means that when an instance of a Flight class is associated with an instance of a FrequentFlyer class, there will also be an instance of a MileageCredit class.
- Reflexive associations
When a class is associated to itself, this does not mean that a class's instance is related to itself, but that an instance of the class is related to another instance of the class.
Interface
#####Nestings
#####Aggregation
- Basic aggregation
In an aggregation relationship, the child class instance can outlive its parent class.
- Composition aggregation
the child class's instance lifecycle is dependent on the parent class's instance lifecycle.
Instances
For example: Donald : person
An example instance of a Plane class UML 2 allows for the modeling of the relationships/associations at the instance level as well
Roles
Modeling the instances of classes is sometimes more detailed than one might wish. Sometimes, you may simply want to model a class's relationship at a more generic level. In such cases, you should use the role notation. The role notation is very similar to the instances notation.
#####Internal Structures
In UML 2, the internal structure notation lets you more clearly show how that class's parts relate to each other.
Sample
[[1] UML basics: The class diagram][UML basics: The class diagram] [UML basics: The class diagram]: http://www.ibm.com/developerworks/rational/library/content/RationalEdge/sep04/bell/ "UML basics: The class diagram" [[2] UML 2 Class Diagram][UML 2 Class Diagram] [UML 2 Class Diagram]: http://www.sparxsystems.com/resources/uml2_tutorial/uml2_classdiagram.html "UML 2 Class Diagram"