Unified Modeling Language/Class diagram
Jump to navigation
Jump to search
A class diagram is one of the most popular types of UML diagrams.
Class Diagrams use implements, composition and aggregation relationships.
---------------------------------------------------- Implementation example: A fedora is a (type of) hat. Arrowhead type: Unfilled closed triangle. Arrow direction: From example to category.
+--------+
| hat |
+--------+
∆
|
|
+--------+
| fedora |
+--------+
------------------------------------------------------------------
Composition example: A heart is a non-removable part of a person.
Arrowhead type: Solid diamond.
Arrow direction: From part to whole.
+--------+
| person |
+--------+
♦
|
|
+--------+
| heart |
+--------+
---------------------------------------------------------- Aggregation example: A hat is a removable part of a person. Arrowhead type: Unfilled-diamond(lozenge). Arrow direction: From part to whole.
+--------+
| person |
+--------+
◊
|
|
+--------+
| hat |
+--------+
----------------------------------------------------------
Inner Class example: Tree_search is an inner class of tree.
Arrowhead type: Oplus(plus in a circle).
Arrow direction: From part to whole.
Purpose: Tree_search is a Search, but Tree_Search
is an inner class of tree.
Only trees need a tree_search class
so it is hidden. Some languages do not
support inner classes. Java does.
+--------+ +---------+
| tree | | search |
+--------+ +---------+
⊕ / \
| |
| |
+-------------+
| tree_search |
+-------------+