Post on 23-Feb-2022
U S E C A S E
&
U S E C A S E S C E N A R I O
H E R N A W A T I S U S A N T I S A M O S I R , S S T . , M . K O M .
D O S E N D 3 T E K N O L O G I I N F O R M A S I
REKAYASA PERANGKAT LUNAK/
SOFTWARE ENGINEERING-1131105
WHY USE USECASE?
OBJECT ORIENTED MODELING
- In software there are several ways approach a model.
- The two most common ways are from an algorithmic perspective and from an object
oriented perspective
~ In traditional view of software development takes algorithmic
perspective, the main building block of software is procedure or function.
As requirement change and the system grows, system built with an
algorithmic focus turn out to be very hard to maintain.
~ In OO perspective the main building block of all software system is the
object or class
UML (UNIFIED MODELING LANGUAGE)
Object oriented modeling appeared between mid 1970s and the late 1980s
~ UML was originally motivated by the desire to standardize the disparate notational systems
and approaches to software design developed by Grady Booch, Ivar Jacobson and James
Rumbaugh at Rational Software in 1994– 1995
~ UML is language for visualizing, specifying, constructing, documenting the artifacts of
software-intensive system.
USE CASES
What is a Use Case? A formal way of representing how a business system interacts with its environment
Illustrates the activities that are performed by the users of the system
A scenario-based technique in the UML
A sequence of actions a system performs that yields a
valuable result for a particular actor.
USE CASE ANALYSIS
What is an Actor?
A user or outside system that interacts with the
system being designed in order to obtain some value
from that interaction
Use Cases describe scenarios that describe the interaction
between users of the system (the actor) and the system itself.
USE CASES
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.
Use case diagrams are closely connected to scenarios. A scenario
is an example of what happens when someone interacts with
the system.
USE CASES
Here is a scenario for a medical clinic.
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. "
We want to write a use case for this scenario.
Remember: A use case is a summary of scenarios for a single task or goal.
USE CASES
Step 1 Identify the actors
As we read the scenario, define those people or systems that are going to
interact with the 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. "
QUESTIONS FOR IDENTIFYING PEOPLE
ACTORS Who is interested in the scenario/system?
Where in the organization is the scenario/system be used?
Who will benefit from the use of the scenario/system?
Who will supply the scenario/system with this information, use this information, and remove this information?
Does one person play several different roles?
Do several people play the same role?
QUESTIONS FOR IDENTIFYING OTHER
ACTORS
What other entity is interested in the scenario/system?
What other entity will supply the scenario/system with this information, use this information, and remove this information?
Does the system use an external resource?
Does the system interact with a legacy system?
ACTORS
An Actor is outside or external the system.
It can be a:
Human
Peripheral device (hardware)
External system or subsystem
Time or time-based event
Represented by stick figure
USE CASES
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 the task of the
use case. Actors are simply roles that people or objects play.
So as we read our scenario, what or who is the actor????
USE CASES
So as we read our scenario, what or who is the actor?
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. "
The actor is a Patient.
USE CASES
The use case is a summary of scenarios for a single task or goal.
So What is the Use Case????
The Use Case is Make Appointment.
It is a use case for the medical clinic.
USE CASES
The picture below is a Make Appointment use case for the medical clinic.
The actor is a Patient. The connection between actor and use case is a
communication association (or communication for short).
Actors are stick figures. Use cases are ovals. Communications are lines that link
actors to use cases.
Actors are stick figures. Use cases are ovals. Communications are
lines that link actors to use cases.
USE CASE COMPONENTS
The use case has three components.
The use case task referred to as the use case that represents a feature needed in a software system.
The actor(s) who trigger the use case to activate.
The communication line to show how the actors communicate with the use case.
USE CASE DIAGRAM - USE CASE A major process performed by the system that benefits an actor(s) in some way
Models a dialogue between an actor and the system
Represents the functionality provided by the system
USE CASE
Each use case in a use case diagram describes one and only one function
in which users interact with the system
May contain several “paths” that a user can take while interacting with the
system
Each path is referred to as a scenario
USE CASE
Labelled using a descriptive verb-noun phrase
Represented by an oval
Make
Appointment
USE CASE - ACTOR
Labelled using a descriptive noun or phrase
Represented by a stick character
USE CASE - RELATIONSHIPS
Relationships
Represent communication between actor and use case
Depicted by line or double-headed arrow line
Also called association relationship
Appointment
USE CASE - RELATIONSHIPS
Boundary
A boundary rectangle is placed around the perimeter of the system to show how the actors
communicate with the system.
Make
Appointment
USE-CASE DIAGRAM
A use case diagram is a collection of actors, use cases, and their communications.
USE CASE DIAGRAM
Other Types of Relationships for Use Cases
Generalization
Include
Extend
COMPONENTS OF USE CASE DIAGRAM
Generalization Relationship
Represented by a line and a hollow arrow
From child to parent
Child use case Parent use case
EXAMPLE OF RELATIONSHIPS
USE CASE DIAGRAM
Include Relationship
Represents the inclusion of the functionality of one use case within another
Arrow is drawn from the base use case to the used use case
Write << include >> above arrowhead line
USE CASE DIAGRAM Extend relationship
Represents the extension of the use case to include optional
functionality
Arrow is drawn from the extension use case to the base use case
Write << extend >> above arrowhead line
EXAMPLE OF RELATIONSHIPS
USE CASE RELATIONSHIPS
Pro:
Reduces redundancy in use cases
Reduces complexity within a use case
Con
May introduce complexity to use case diagram
BENEFITS OF USE CASES
1. Use cases are the primary vehicle for requirements capture in RUP
2. Use cases are described using the language of the customer (language of the domain
which is defined in the glossary)
3. Use cases provide a contractual delivery process (RUP is Use Case Driven)
4. Use cases provide an easily-understood communication mechanism
5. When requirements are traced, they make it difficult for requirements to fall through the
cracks
6. Use cases provide a concise summary of what the system should do at an abstract (low
modification cost) level.
DIFFICULTIES WITH USE CASES
1. As functional decompositions, it is often difficult to make the transition from
functional description to object description to class design
2. Reuse at the class level can be hindered by each developer “taking a Use
Case and running with it”. Since UCs do not talk about classes, developers
often wind up in a vacuum during object analysis, and can often wind up
doing things their own way, making reuse difficult
3. Use Cases make stating non-functional requirements difficult (where do you
say that X must execute at Y/sec?)
4. Testing functionality is straightforward, but unit testing the particular
implementations and non-functional requirements is not obvious
USE CASE DIAGRAM
1. We will build use case diagram for a video rental system.
2. Look and identify potential actors and use case tasks.
3. Nouns and verbs may be helpful.
DIFFERENCE BETWEEN INCLUDES AND EXTENDS?
X includes Y:
X memiliki subtask Y
Agar X complete, subtask Y juga harus dilakukan
Contoh: “Memeriksa saldo” includes “verifikasi PIN”
X extends Y:
X dan Y memiliki task yang “serupa”, namun X memiliki task yang lebih
spesifik dari Y
Contoh: “Memesan minuman” extends “memesan makanan”
TYPES OF ACTORS
Primary Business Actor
Actor yang mendapatkan manfaat utama dari use case yang terkait
Contoh: pegawai menerima gaji
Primary System Actor
Actor yang secara langsung berinteraksi dengan sistem – memberikan
trigger ke sistem
Contoh: admin meng-input katalog buku
1. FIND ACTORS
To find the actors, ask the following questions:
Who or what provides inputs to the system?
Who or what receives outputs from the system?
Will the system interact with any external hardware or software system?
Who will maintain information in the system?
Are there events that are automatically triggered at a predetermined time?
Actors should be named with a noun or noun phrase
2. IDENTIFYING USE CASES
Check out the user requirements and functional requirements
What are the main tasks of the actor?
What information does the actor need from the system?
What information does the actor provide to the system?
Does the system need to inform the actor of any changes or events that have
occurred?
Does the actor need to inform the system of any changes or events that have
occurred?
Use cases should be named with a verb phrase specifying the goal of the
actor (i.e. Submit Subscription Order)
ANOTHER EXAMPLE USECASE
39 Take from: Roger S. Pressman Ed 5[6]
Figure 21.2 A describes Each of the
high-level use-cases may be
elaborated with lower-level use-case
diagrams.
Figure 21.B represents a use-case
diagram that elaborates the interacts
function. A complete set of use-case
diagrams is created for all actors.
3. CONSTRUCT THE USE CASE DIAGRAM
Use the UML notations for Use Case!
4. ELEMENTS OF USE CASE SCENARIOS
Use Case ID
Use Case Name
Brief Description
Primary Actor
Secondary Actor
Pre-condition
Post condition
Included Use Case
Basic Flow Events
Alternative Flow Events
Extention Points
FURTHER READINGS
http://www.sparxsystems.com/resources/map_uc.html
USE CASE: MENGAMBIL UANG DARI ATM
1. Use Case ID: UC_SR_001
2. Use Case Name: Mengambil Uang di ATM
3. Brief Description:
Use case ini menjelaskan bagaimana nasabah menggunakan
ATM untuk mengambil uang dari rekeningnya.
4. Primary Actor: Nasabah Bank
5. Secondary Actor: -
USE CASE: MENGAMBIL UANG DARI ATM 6. Precondition:
- Nasabah memiliki kartu ATM
- Nasabah sudah memasukkan kartu ATM ke mesin ATM
- Nasabah sudah memasukkan pilihan bahasa
Kartu ATM berhasil divalidasi
- Mesin ATM masih memiliki uang kas
7. Post condition:
- Nasabah berhasil mengambil uang dari ATM
8. Included Use Case: Validasi Kartu (PIN)
USE CASE: MENGAMBIL UANG DARI ATM
9. Basic Flow of Events:
User’s Actions System’s Response
1. Sistem menampilkan beberapa pilihan nominal uang yang dapat ditarik dan menu pilihan lainnya
2. Nasabah memasukkan pilihan nominal sesuai jumlah uang yg ingin diambil
3. . Sistem mengeluarkan uang. Sistem akan mengurangi jumlah saldo rekening berdasarkan pilihan nasabah
4. Nasabah mengambil uang
USE CASE: MENGAMBIL UANG DARI ATM
10. Alternative Flow of Events
2a. Jumlah uang yg ditarik melebihi jumlah saldo di rekeningnya. Sistem akan menampilkan “warning message” dan pilihan untuk kembali ke menu utama
2b. Jumlah uang yg ditarik melebihi jumlah total penarikan uang per hari. Sistem akan menampilkan “warning message” dan pilihan untuk kembali ke menu utama
2c. Jumlah uang kas yang tersedia di mesin ATM tidak mencukupi. Sistem akan menampilkan “warning message” dan pilihan untuk kembali ke menu utama
REFERENCES
1. Whitten, Jeffrey L., Bentley, Lonnie D., System Analysis and Design Methods, 7th Edition, McGraw-Hill Irwin, 2007 (Chapter 10)
2. Dennis, Alan, et. al., System Analysis and Design with UML 3rd Edition, John Wiley & Sons, 2010.
3. Mursanto, Petrus., Budiharjo, Eko., Slide Perkuliahan RPL Fakultas Ilmu Komputer UI, 2009
4. Object Oriented Systems Analysis and Design – Simon Bennet, p.104 figure 5.8
5. Development of the use case model through successive iterations
6. Pressman, Roger S., 2001. Software Engineering: A Practitioner’s Approach, 5th Edition, USA: Mc. Graw Hill International (Ed5)
7. AMS Slide TA 2018