The Unified Modeling Language (UML) is a language which can be used to model software
systems. It is is not a programming language or a tool. With UML you can specify (what and how),
visualize, construct, and document artifacts (= deliverables, such as
documents, source code etc).
UML was conceived by Rational Software Corporation and three persons Grady Booch, James Rumbaugh,
and Ivar Jacobson.
UML is maintained by the Object management Group (OMG) and more information can be found at their website:
http://www.uml.org/
This UML reference contains brief summaries of UML elements. All drawings are created with
ArgoUML.
Composition ("has a" relationship).
A composition is a "has a" relationship where parts (one or more classes)
belongs to a whole (=collection).
If the whole is destroyed, the parts are destroyed.
Thus the parts are dependent of the whole and the whole requires the parts.
A composition is a more restricted aggregation. The parts are non-shareable and can not be used
in other aggregates. In other words: "An individual part cannot be "owned" by multiple wholes."
The whole has a filled diamond ending point.
Inheritance
"Is A"
Strongest Relationship
|
Composition
"Has A"
Stronger RelationShip
|
Aggregation
"Part-of"
Weakest RelationShip
|
Example 1:
The Indy Car racing consist of several teams. The teams only exists during the Indy Car racing.
If the Indy Car racing does not exists, the teams does not exist and vice versa.
Each team has 2 cars and these cars can used elsewhere if needed (e.g. in a street car racing).
class Chassis {
//..
}
|
class Car {
Chassis chassis = new Chassis();
}
|
Example 2:
The Space Shuttle has 3 engines, 2 wings and can carry between 2 to 6 astronauts. The engines and wings
are part of the Space Shuttle and can not be used elsewhere (e.g. on other planes).
The astronauts however are "shareable", the astronauts can also be on the Russia Progress "space truck".
class Chassis {
//..
}
|
class Car {
Chassis chassis = new Chassis();
}
|
|
|