Unified Modelling
Language(UML)
Department of Computer Science
COM 213B
ND II
Course Lecturer: Bekee SorBarisere Y.
WEEK Three
Outline
THE STRUCTURE DIAGRAM –
Introduction
Class diagram
Inheritance
Association.
Introduction
The Unified Modelling Language (UML) is a general- purpose,
developmental, modelling language in the field of software
engineering & development, with an intention of providing a
standard way of visualize the design of a system.
The elements are like components which can be associated in
different ways to make a complete UML pictures which is known as
diagram. So it is very important to understand the different
diagrams to implement the knowledge in real life systems.
The structure diagrams show the static structure of the system
being modelled; focusing on the elements of a system, irrespective
of time.
Static structure is conveyed by showing the types and
theirinstances in the system.
Structure diagrams also show at least some of the
relationships among and between these elements and
potentially
even show their internal structure.
The Structure diagrams and its
various components
The Class Diagram
The Class diagram describes the structure of a
system by showing the system's classes, their
attributes, and the relationships among the
classes
The purpose of the class diagram is to show
the types being modelled within the system.
In most UML models these types include:
a class, an interface , a data type and a component.
The UML representation of a class is a rectangle
containing three compartments stacked vertically, as
shown in the next slide.
Airline flight modelled as a UML class
CLASS NAME
CLASS
ATTRIBUTES
CLASS
OPERATIONS
Class Attribute list.
The attribute section of a class (the middle
compartment) lists each of the class's
attributes on a separate line.
the class's attributes with the attribute type
information can describe as shown below.
Attribute Type
Attribute Name
flightNumber Integer
departureTime Date
flightDuration Minutes
Inheritance
Inheritance, refers to the ability of one class (child
class) to inherit the identical functionality of
another class (super class), and then add new
functionality of its own.
To model inheritance on a class diagram, a solid
line is drawn from the child class (the class
inheriting the behavior) with a closed, unfilled
arrowhead (or triangle) pointing to the super class
There two methods of drawing inheritance
diagram.
Method used in IBM Rational Rose and IBM
Rational XDE
The Tree notation
Inheritance diagram method used in IBM
Rational Rose and IBM Rational XDE
Inheritance using tree
notation
Associations
Association refers to the relationship that
exist amongst object of a system being
modelled
An association is a linkage between two
classes
There are five(5) types of Association.
Bi-directional (Standard) association
uni- directional associations
Association class
Aggregation, and
Reflexive associations --
Bi-directional (standard) association
this means that both classes are aware
of each other and their relationship
A bi-directional association is indicated by a
solid line between the two classes. At either
end of the line, you place a role name and a
multiplicity value
Role name uniquely identifies an object or
set of objects associated with each other
It clarifies the purpose an object serves in
an association
Multiplicity: the number of instances of one
class that may relate to an instance of an
associated class
Multiplicity values and their indicators
Potential Multiplicity Values
Indicator Meaning
0..1 Zero or one
1 One only
0..* Zero or more
* Zero or more
1..* One or more
3 Three only
0..5 Zero to Five
5 - 15 Five to Fifteen
Uni-directional association
Two classes are related, but only one class
knows that the relationship exists
A uni-directional association is drawn as a
solid line with an open arrowhead (not the
closed arrowhead, or triangle, used to
indicate inheritance) pointing to the known
class.
Association class
Itis class included when modelling
association because it contains valuebe
information about the relationship
The association class is represented like a
normal class
Line between the primary class intersected
with dotted line connecting the association
class
Aggregation
Aggregation is a special type of association
used to model a "whole to its parts"
relationship
There two types of aggregation
Basic aggregation
Composition aggregation
In basic aggregation relationships, the
lifecycle of a part class is independent from
the whole class's lifecycle
example, Car whole entity
Car Wheel as part of the overall Car
In an aggregation relationship, the child class
instance can outlive its parent class
To represent an aggregation relationship
draw a solid line from the parent class to
the part class
draw an unfilled diamond shape on the
parent class's association end.
Incomposition aggregation relationship, the
child class's instance lifecycle is dependent
on the parent class's instance lifecycle
The composition relationship is drawn like
the aggregation relationship, but this time
the diamond shape is filled.
Reflexive associations
Reflexive association occurs when a class
associates with itself
An instance of the class is related to
another instance of the class