You are on page 1of 40

Introduction to UML Diagrams

Topic & Structure of the lesson


Introduction to UML Diagrams
Use Case Diagram
Sequence Diagram
Class Diagram

CT026-3-1 Systems Analysis and Design

Introduction to UML Diagrams

Learning Outcomes
By the end of this lecture, YOU should
be able to :
Demonstrate and apply the key techniques of
analysis and design for the chosen
methodology
Appreciate the use of an analytical framework
for the analysis and design process
Document each stage of analysis and design
to the appropriate standards
CT026-3-1 Systems Analysis and Design

Introduction to UML Diagrams

Key Terms you must be able to use


If you have mastered this topic, you
should be able to use the following terms
correctly in your assignments and exams:
Use Case Diagram
Association
Aggregation
Multiplicity
Generalization
Navigability
CT026-3-1 Systems Analysis and Design

Introduction to UML Diagrams

UML
Unified Modeling Language (UML)
for specifying, visualizing, constructing and
documenting artifacts
of software system
business models
non software systems.

CT026-3-1 Systems Analysis and Design

Introduction to UML Diagrams

UML
UML is important , why?
it shows a blue print of the system
identifies the complexity of the system.

An essential tool for communication among


project team members.

CT026-3-1 Systems Analysis and Design

Introduction to UML Diagrams

Types of UML Models


Examples:
Use Case
Class Diagrams
Sequence Diagrams
Interaction Diagrams
Collaboration Diagrams
State Diagrams
CT026-3-1 Systems Analysis and Design

Introduction to UML Diagrams

Use Case Diagrams


Describe what a system does from the
standpoint of an external observer. The
emphasis is on what a system does rather
than how.
Are closely connected to scenarios. A
scenario is an example of what happens
when someone interacts with the system.
CT026-3-1 Systems Analysis and Design

Introduction to UML Diagrams

Use Case Diagrams


A use case is a summary of scenarios for
a single task or goal.
An actor is who or what initiates the
events involved in that task.
Actors are simply roles that people or
objects play.
Use case is the activity/process/behavior
CT026-3-1 Systems Analysis and Design

Introduction to UML Diagrams

Use Case Diagrams


Example scenario
"A patient calls the clinic to make an
appointment for a yearly checkup. The
receptionist finds the nearest empty time
slot in the appointment book and
schedules the appointment for that time
slot. "

CT026-3-1 Systems Analysis and Design

Introduction to UML Diagrams

Use Case Diagrams


A use case diagram is a collection of actors, use
cases, and their communications

CT026-3-1 Systems Analysis and Design

Introduction to UML Diagrams

Importance of Use Case Diagrams


Determining features (requirements).
New use cases often generate new requirements as
the system is analyzed and the design takes shape.

Communicating with clients.


Their notational simplicity makes use case diagrams
a good way for developers to communicate with
clients.

Generating test cases.


The collection of scenarios for a use case may
suggest a suite of test cases for those scenarios.
CT026-3-1 Systems Analysis and Design

Introduction to UML Diagrams

Quick Review Question


Three items of interest in use case
diagrams are:
Objects, activities, and communications
Actors, messages, and activities
Objects, use cases, and activities
Actors, use cases, and communications

CT026-3-1 Systems Analysis and Design

Introduction to UML Diagrams

Class Diagrams
Gives an overview of a system by showing
its classes and the relationships among
them.
Are static -- they display what interacts but
not what happens when they do interact.
The diagram identifies the attributes and
operations associated with it

CT026-3-1 Systems Analysis and Design

Introduction to UML Diagrams

Class diagram
Stages in building a class diagram:
Identify objects and derive classes from
them

Every noun is an object generalised to a class

Identify attributes of classes

Features/characteristics of the class/object

Begin to construct a data dictionary

To describe classes and their features

Identify operations on classes

class behavior

CT026-3-1 Systems Analysis and Design

Introduction to UML Diagrams

Class Diagram
. Use the CRC card technique to uncover
responsibilities and collaborations

Class-responsibility-collaboration(CRC)
Sort out the functionality of the class

What we want them to do

To identify and break-up functionality between


classes
Considers purpose of the class in terms of
responsibility to provide services to other classes
Responsibility describes something the class can
do

CT026-3-1 Systems Analysis and Design

Introduction to UML Diagrams

Class Diagram
Identify relationships between classes, using
association, aggregation and generalization

Collaboration between objects to achieve


purpose of the system
Specify how objects are related to achieve this
collaboration
The notation used to state this collaboration is
multiplicity

Iterate and refine the model

through a process of validation

CT026-3-1 Systems Analysis and Design

Introduction to UML Diagrams

Class relationships
3 types, why?
Because the objects must collaborate with
each other.
Need to specify how these classes are related
to achieve this collaboration.
What are they?
Association
Aggregation
Generalization

CT026-3-1 Systems Analysis and Design

Introduction to UML Diagrams

Association
Means, there is a relationship between objects of these
classes.
A relationship between two or more classifiers that involves
connections among their instances.
Symbol : _________
Eg. Student studies a course
Entities student, course
Relationship studies
Type of relationship specified by multiplicity
Eg. One course is studied by many students
Multiplicity no. of objects of each class that may be
connected in this way
CT026-3-1 Systems Analysis and Design

Introduction to UML Diagrams

Association
Types of multiplicity:

CT026-3-1 Systems Analysis and Design

Multiplicity

Meaning

0..1

Zero or one

Exactly one

*, 0..*

Zero, one or many

1..*

One or many

2, 3, 24

An exact number

2..4, 8..*

A range

Introduction to UML Diagrams

Association
Class Relationships
3 kinds
Association
structural connection between classes
UML Association Notation bidirectional

CT026-3-1 Systems Analysis and Design

Introduction to UML Diagrams

Slide 8 (of 24)

Association
Association
One-Way Navigation between classes uses arrow head

Named Association

CT026-3-1 Systems Analysis and Design

Introduction to UML Diagrams

Slide 9 (of 24)

Association
Association
Association Rules state relationship

Association Multiplicity many notations available

CT026-3-1 Systems Analysis and Design

Introduction to UML Diagrams

Slide 10 (of 24)

Aggregation
When one class is made up of several classes
A special form of association that specifies a
whole-part relationship between the aggregate
(whole) and the component part.
part-of, consist-of, is made up of; give clues of
an aggregation relationship
Represented as a diamond in the class diagram
Eg. Car park is made up of card readers.
(Each person who parks has a card to identify the type
of customer, staff/customer parking)
CT026-3-1 Systems Analysis and Design

Introduction to UML Diagrams

Aggregation
UML Aggregation Notation

Aggregation
A whole / part relationship

Self-aggregation

Aggregating Multiple Classes

CT026-3-1 Systems Analysis and Design

Introduction to UML Diagrams

Slide 11 (of 24)

Generalization
When one class is a specialization of another
inheritance
A taxonomic relationship between a more general
and a more specific element.
Eg:
a car park has two types of cards; staff card, visitor card.
Both cards have common attributes, that will be stated in
the parent class
Differences will be stated in the child classes

Represented by a triangle
CT026-3-1 Systems Analysis and Design

Introduction to UML Diagrams

Generalization
Generalization / inheritance
relationship between a superclass and the subclasses

Generalizing Multiple Classes


UML Generalization Notation
CT026-3-1 Systems Analysis and Design

Introduction to UML Diagrams

Slide 12 (of 24)

Quick Review Question

Name 3 types of class relationships


citing appropriate examples.

CT026-3-1 Systems Analysis and Design

Introduction to UML Diagrams

Slide 20 (of 24)

Class Diagrams

CT026-3-1 Systems Analysis and Design

Introduction to UML Diagrams

Sequence Diagram
An interaction diagram
How operations are sent?
What messages are sent?
When messages are sent?

Organised according to time


Objects in operation are from left to right
According to when they take part in the message
sequence

CT026-3-1 Systems Analysis and Design

Introduction to UML Diagrams

Slide 4 (of 13)

Sequence Diagram
Used during requirement elicitation
Refine use case description
Specify event flows in use case
Identify participating objects: including
external actors and internal objects
Assign parts of use case behaviour to
participating objects
Used during system design
Refine subsystem interface
CT026-3-1 Systems Analysis and Design

Introduction to UML Diagrams

Slide 5 (of 13)

Sequence Diagram
Formalize behaviour of system
Visualize the communication among
objects (participating objects)
Focus on message exchange as a
result of events created by the actor

CT026-3-1 Systems Analysis and Design

Introduction to UML Diagrams

Slide 6 (of 13)

Sequence Diagram
Objects interact with each other by
sending messages
Reception
of
message
triggers
execution of an operation in the
receiving object
Arguments may be passed alone with
message and are bound to the
parameter of the executing operation in
the receiving object
CT026-3-1 Systems Analysis and Design

Introduction to UML Diagrams

Slide 7 (of 13)

Sequence Diagram
The vertical dashed line is called the objects
Lifeline and represents time. (Lifeline vertical dashed
line)

The classes involved in the interaction are placed


horizontally across the diagram.
A message is shown by a solid horizontal arrow
from one lifeline to another and this is labeled
with the message name. (Message solid horizontal
arrow)

When a message is sent it invokes an operation


Once a message is received, the operation that
has been invoked begins to execute (activation)
The activation is shown by a rectangular block
along the lifeline. (Activation rectangular block)
CT026-3-1 Systems Analysis and Design

Introduction to UML Diagrams

Slide 8 (of 13)

Sequence Diagram
(Cont)
objects

Hotel Computer System

mary: Guest

324 : Room

Interface to
real-world guest

Knows whether
occupied and available

leaving

occupied
I am vacating
unoccupied
& unclean

fred: Cleaner
Schedules activities
of real-world cleaner

clean me
you are clean

hilton : Hotel
Assigns Guests to Rooms

clean room 324


done room 324

message
I am available

unoccupied
& clean

return
lifeline
CT026-3-1 Systems Analysis and Design

Activation
Introduction to UML Diagrams

Slide 9 (of 13)

Sequence Diagram

CT026-3-1 Systems Analysis and Design

Introduction to UML Diagrams

Slide 10 (of 13)

Sequence Diagram Example

CT026-3-1 Systems Analysis and Design

Introduction to UML Diagrams

Slide 11 (of 13)

Summary of Main Teaching Points


Introduction to UML Diagrams
Use Case Diagram
Sequence Diagram
Class Diagram

CT026-3-1 Systems Analysis and Design

Introduction to UML Diagrams

Slide 41 (of 43)

Question and Answer Session

Q&A
CT026-3-1 Systems Analysis and Design

Introduction to UML Diagrams

Slide 42 (of 43)

Next Session

Tutorial

CT026-3-1 Systems Analysis and Design

Introduction to UML Diagrams

Slide 43 (of 43)