0% found this document useful (0 votes)
36 views41 pages

Software Engineering-Lecture 04

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views41 pages

Software Engineering-Lecture 04

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 41

CS/SE/IT1211-Software Engineering

Lecture 04
Use case Diagrams
BSc (Hons) Computer Science|Software Engineering|Information
Technology
Department of Computer Science
Faculty of Computing & Technology
Saegis Campus
Nugegoda.

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh) Seagis Campus 1


Use Case Diagrams

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh)


Content
•Introduction
•Components of a Use case diagram
– System – Actors
– Use cases – Relationships
•Applying use case diagrams in real world applications
•Use case scenarios

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh) Seagis Campus 3


Requirements Specification
•Structured Natural Language
User Stories
•Mathematical Specifications
Decision Trees, Decision Tables
•Graphical Notations
Use Case Diagrams and Use Case Scenarios
Activity Diagrams
Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh) Seagis Campus 4
What is a Use Case Diagram?

Use Case Model;


–Graphically represent the proposed functionality of
the new system.
–Use Case Model captures the functional requirements
of a system.
–Help to demonstrate the high-level behavior of the
proposed system to the clients

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh) Seagis Campus 5


Use Cases for Requirements Engineering
•Use case modelling support requirements elicitation
•Use cases act as a means of communicating with stakeholders about
what the system is intended to do.
–It is an excellent way to communicate to management, customers,
and other non-development people:
–WHAT a system will do when it is completed.
–But….it does not go into detail of HOW a system will do anything.

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh) Seagis Campus 6


Components of a Use Case Diagram

To construct a Use Case diagram, there are FOUR


basic components.
System: something that performs function(s).
Actors: the roles adopted by those participating.
Use Cases: high level activities to be supported by the system.
Relationships / Links: which actors are involved in which use
cases (dependency, generalization, and association).

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh) Seagis Campus 7


1) System

System is something which perform function(s).


System Boundary Represents the boundary between the
(physical) system and the actors who interact with the
(physical) system.

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh) Seagis Campus 8


System - example

System Boundary

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh) Seagis Campus 9


2) Actors
A Use Case Diagram shows the interaction between the system
and entities external to the system. These external entities are
referred to as Actors.
Actors represent roles which may include human users, external
hardware or other systems.
Actors have direct interactions with the system
Notation

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh) Seagis Campus 10


Activity

1. Identify Actors of the Saegis


Campus Library system.

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh) Seagis Campus 11


3) Use Case
A Use Case is a unit of behavior in the proposed system
It represents a unit of interaction between a user and the
proposed system.
Use case name typically has a verb-noun phrase
Notation
Make Payment

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh) Seagis Campus 12


How to Identify a Use case?
•Consider what each actor requires of the system.
•For each actor, human or not, ask yourself the following questions
in order to figure out the relevant use cases.
What are the primary tasks the actor wants the system to perform?
Will the actor create, store, change, remove, or read data in the system?
Will the actor need to inform the system about sudden, external changes?
Does the actor need to be informed about certain occurrences in the system?
Will the actor perform a system start-up or shutdown?

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh) Seagis Campus 13


Activity
2. Identify use cases for each of the actors in the Saegis Campus
Library System.

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh) Seagis Campus 14


4) Relationships
•Below mentioned are the main types of relationships used in use
case diagrams.
Relationships

Actor Use case


Relationships Relationships

Association Generalization Include Extend Generalization

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh) Seagis Campus 15


Actor to Use case Relationships
•Association.
indicates that an actor
participates in (i.e. communicates
with) the use case.

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh) Seagis Campus 16


Activity

3. Draw the Actors and Associations for the Saegis Campus Library
System.

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh) Seagis Campus 17


Actor to Actor Relationships

•Generalization
Actor Generalization is drawn from the concept of inheritance in
Object Oriented Programming.
A child actor Inherits all of the characteristics and behavior of the
parent actor.
Can add , modify, or ignore any of the characteristics and
behaviors of the parent actor.

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh) Seagis Campus 18


Who has the most rights in the system?

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh) Seagis Campus 19


Example – Public Library

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh) Seagis Campus 20


Activity
4. Draw the actor to actor relationships for the Saegis
Campus Library System

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh) Seagis Campus 21


Include Relationship
1) Include
– The base use case explicitly incorporates the behavior of
another use case at a location specified in the base.
– The included use case never stands alone. It only occurs as a
part of some larger base that includes it.

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh) Seagis Campus 22


Include Relationship
•Enables us to avoid describing the same flow of events
several times by putting the common behavior in a use case
of its own.

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh) Seagis Campus 23


Activity
•Update the use case diagram of the
Public Library for the below given
criteria.
When member is reserving the
books he/she has to login to the
system.

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh) Seagis Campus 24


Activity
5. Draw the include relationships between the use cases for the
Saegis Campus Library System

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh) Seagis Campus 25


Extend Relationship
2) Extend
– The base use case implicitly incorporates the behavior of another use case
at certain points called extension points.
– The base use case may stand alone, but under certain conditions its
behavior may be extended by the behavior of another use case.

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh) Seagis Campus 26


Extend Relationship
•Eg:- When a student get enrolls in the university they perform a visa
check if he/she is a foreign student.

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh) Seagis Campus 27


Activity

•Update the Public Library for


the below given criteria.
Member can renew the books
he/she has borrowed.
When renewing if book has exceeded
the loan period a fine will be
calculated. For renewing purposes
the member should login to the
system.
Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh) Seagis Campus 28
Activity

6. Draw the extends relationships for the Saegis


Campus Library System

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh) Seagis Campus 29


Generalization Relationship
3) Generalization
– The child use case inherits the behavior and
meaning of the parent use case.
– The child may add to or override the behavior of its
parent.

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh) Seagis Campus 30


Generalization Relationship

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh) Seagis Campus 31


Activity

•Update the use case diagram of the


Public Library for the below given
criteria.
Library Manager can generate
reports of the Borrowed books,
Overdue books at the end of each
month.

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh) Seagis Campus 32


Relationship Summary

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh) Seagis Campus 33


Use Case Scenarios

•A Scenario is a formal description of the flow of events that occur during the
execution of a Use Case instance. It defines the specific sequence of events
between the system and the external Actors.

•There is usually a Main scenario, which describes what happens when


everything goes to plan. It is written under the assumption that everything is
okay, no errors or problems occur, and it leads directly to the desired
outcome of the use-case.
Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh) Seagis Campus 34
Use Case Scenarios
•Other scenarios describe what happens when variations to the Main
scenario arise, often leading to different outcomes.
•So the flow of events should include:
–How and when the use case starts and ends
–When the use case interacts with the actors
–What objects are exchanged
–The basic flow and
–Alternative flows (exceptional) of the behavior
Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh) Seagis Campus 35
Use Case Sample Template

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh) Seagis Campus 36


Use Case Specification Template*

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh) Seagis Campus 37


Use Case Specification Template Example

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh) Seagis Campus 38


Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh) Seagis Campus 39
Activity

• Write a Use Case Scenario for “Borrowing a Book”


You could consider the process given below as the manual system procedure.

The member identifies him or herself to the librarian and indicates which
books they wish to borrow. If it is acceptable for them to borrow these books,
i.e. they are not marked “for reference only”, or the number of books on loan
to the customer is less than some predetermined maximum, then the books
are loaned to the customer for a specified loan period. The members loan
record is updated to reflect the loaned books. The libraries card index system is
updated to show who has borrowed the books.

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh) Seagis Campus 40


Next Lecture…?
Lecture 05 – Activity
Diagrams

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh) Seagis Campus 41

You might also like