Unified Modeling Language/Class diagram: Difference between revisions
Jump to navigation
Jump to search
imported>Eric Evers (New page: A class diagram is one of the most popular types of UML diagrams.) |
imported>Eric Evers No edit summary |
||
Line 1: | Line 1: | ||
A class diagram is one of the most popular types of UML diagrams. | 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 | | |||
+-------------+ |
Revision as of 11:23, 17 November 2008
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 | +-------------+