Title: Class Diagram
1Class Diagram A class wraps attributes (data)
and behaviors (methods or functions) into a
single distinct entity. Objects are instances of
classes.
2Class Notation UML class notation is a rectangle
divided into three compartments class name,
attributes, and operations. Names of abstract
classes are in italics. Public, protected, and
private visibilities are denoted using , , and
respectively. It is often desirable to define
explicit responsibilities for a class. These
represent the obligations that one class has. You
can use an extra compartment to indicate
responsibilities.
3(No Transcript)
4Association An association is a structural
connection between classes. There is an
association between two classes if an instance of
one class must know about the other in order to
perform its work. In a diagram, an association is
a link connecting two classes. One-way
navigation An association is assumed to be
bidirectional, which means one can navigate from
either class to the other one. That is, both
classes know about each other. However, one can
specify that navigation can only occur from one
class to another, by using a feathered arrow.
5(No Transcript)
6Named associationAn association can have a name
that indicate the nature of the relationship. If
a name is present, there can also be a triangle
to show the direction in which you should read
the name.
7RolesAn association can contain roles. Roles are
added at the end of an association.
8MultiplicityThe multiplicity indicates the
number of possible instances of the class
associated with an instance of the other class.
This table gives the most common
multiplicities. Multiplicity Indicator
Meaning 0..1 Zero or one1 One
only0.. Zero or more1.. One or
moren Only n (where n gt 1)0..n Zero to n
(where n gt 1)1..n One to n (where n gt 1)
9Agregation An aggregation is a "whole/part"
relationship. In UML, an aggregation is shown by
using a line with an open diamond at one end.
Composition Composition is a strong form of
aggregation within which the parts lives and dies
with the whole.
10(No Transcript)
11Generalization An inheritance link indicating one
class is a superclass of the other. A
generalization has a triangle pointing to the
superclass.
12(No Transcript)
13Association Class An association class is used to
model an association that has interesting
characteristics of its own outside the classes it
connects. An association class is connected to
the association using a dashed line.
14(No Transcript)
15Class diagrams A class diagram shows classes and
the various relationships in which they are
involved.