What Is A Class Diagram?
What Is A Class Diagram?
That’s where class diagrams come in. Class diagrams are a neat
way of visualizing the classes in your system before you actually
start coding them up. They’re a static representation of your
system structure.
Association
a relationship between two separate classes. It joins two entirely
separate entities. There are four different types of association: bi-
directional, uni-directional, aggregation (includes composition
aggregation) and reflexive. Bi-directional and uni-directional
associations are the most common ones.
Inheritance
indicates that child (subclass) is considered to be a specialized
form of the parent (super class). For example consider the
following:
Realization/Implementation
a relationship between two model elements, in which one model
element implements/executes the behavior that the other model
element specifies.
example of implements
Dependency
Aggregation
a special form of association which is a unidirectional (a.k.a one
way) relationship between classes. The best way to understand this
relationship is to call it a “has a” or “is part of” relationship. For
example, consider the two classes: Wallet and Money. A wallet
“has” money. But money doesn’t neccessarily need to have a wallet
so it’s a one directional relationship.
Composition
a restricted form of Aggregation in which two entities (or you can
say classes) are highly dependent on each other.
Multiplicity
after specificyfing the type of association relationship by
connecting the classes, you can also declare the cardinality
between the associated entities. For example:
The above UML diagram shows that a house has exactly one
kitchen, exactly one bath, atleast one bedroom (can have many),
exactly one mailbox, and at most one mortgage (zero or one).