@startuml
abstract class Animal
interface Behaviour
interface Prey
Animal <|-- Lion : inheritance
Behaviour <|.. Animal : realization/implementation
Lion -left-* Pride : composition
interface Grouping
Grouping <|.. Pride
Prey -left-O Lion : aggregation
Water <-down- Lion : uni-directional
Habitat -up- Lion : bi-directional
@enduml
abstract class Animal
interface Behaviour
interface Prey
Animal <|-- Lion : inheritance
Behaviour <|.. Animal : realization/implementation
Lion -left-* Pride : composition
interface Grouping
Grouping <|.. Pride
Prey -left-O Lion : aggregation
Water <-down- Lion : uni-directional
Habitat -up- Lion : bi-directional
@enduml
- implementation/realization
- a dotted line with a closed, unfilled arrow means realization (or implementation). The arrow points to the interface.
- inheritance
- Inheritance is indicated by a solid line with a closed, unfilled arrowhead pointing at the super class
- aggregation
- a solid line with an unfilled diamond at the class which uses the other class
- composition
- a solid line with an filled diamond at the class which contains the other class
- bi-directional association
- A bi-directional association is indicated by a solid line between the two classes. In the example, the Lion lives in his Habitat, but the Habitat benefits in some way from the Lion as well.
- uni-directional association
- A uni-directional association is indicated by a solid line between the two classes. The class that knows nothing of the other class, has an open arrowhead pointing to it. A Lion uses Water, but not the other way around.
References
- [1] Wikipedia - Class diagram
- http://en.wikipedia.org/wiki/Class_diagram
- [2] IBM Developer Works - UML basics The class diagram
- https://www.ibm.com/developerworks/rational/library/content/RationalEdge/sep04/bell/
- What's the difference between Aggregation and Composition?
- http://randomthoughtsonjavaprogramming.blogspot.nl/2013/11/whats-difference-between-aggregation.html
No comments:
Post a Comment