Title: System Analysis and Design II
1System Analysis and Design II
2Outline
- Scenarios
- Use cases
- Use case descriptions
- Use case diagrams
- Activity Diagrams
3Scenarios
- A narrative description of what people do and
experience as they try to make use of computer
systems and applications M. Carrol,
Scenario-based Design, Wiley, 1995 - A concrete, focused, informal description of a
single feature of the system used by a single
actor. - Scenarios can have many different uses during the
software lifecycle - Requirements Elicitation As-is scenario,
visionary scenario - Client Acceptance Test Evaluation scenario
- System Deployment Training scenario.
4Scenarios Examples
- What needs to be done to report a Cat in a Tree
incident? - What do you need to do if a person reports
Warehouse on Fire? - Who is involved in reporting an incident?
- What does the system do, if no police cars are
available? If the police car has an accident on
the way to the cat in a tree incident? - What do you need to do if the Cat in the Tree
turns into a Grandma has fallen from the
Ladder? - Can the system cope with a simultaneous incident
report Warehouse on Fire?
5Scenario Example Warehouse on Fire
- Bob, driving down main street in his patrol car
notices smoke coming out of a warehouse. His
partner, Alice, reports the emergency from her
car. - Alice enters the address of the building, a brief
description of its location (i.e., north west
corner), and an emergency level. In addition to a
fire unit, she requests several paramedic units
on the scene given that area appear to be
relatively busy. She confirms her input and waits
for an acknowledgment. - John, the Dispatcher, is alerted to the emergency
by a beep of his workstation. He reviews the
information submitted by Alice and acknowledges
the report. He allocates a fire unit and two
paramedic units to the Incident site and sends
their estimated arrival time (ETA) to Alice. - Alice received the acknowledgment and the ETA.
6Observations about Warehouse on Fire Scenario
- Concrete scenario
- Describes a single instance of reporting a fire
incident. - Does not describe all possible situations in
which a fire can be reported. - Participating actors
- Bob, Alice and John
7Next goal, after the scenarios are formulated
- Find all the use cases in the scenario that
specifies all possible instances of how to report
a fire - Report Emergency in the first paragraph of the
scenario is a candidate for a use case - Open Incident is another use case (3rd
paragraph) - Allocate resources is another use case (3rd
paragraph) - Describe each of these use cases in more detail
- As text (use case descriptions)
- As diagrams ( use case diagrams)
8Use Cases
- A use case is an abstraction of scenarios
- A use case is a flow of events in the system,
including interaction with actors (users or
systems) - Each use case describes one function in which the
user interacts with the system - It is initiated by an actor (user or systems)
- Each use case has a name
Use Case Model The set of all use cases
specifying the complete functionality of the
system
9Use Case Descriptions
10Elements of a Use-Case Description
Use Case Name ID Importance Level Primary
Actor Use Case Type Stakeholders and
Interests Brief Description Trigger Relation
ships (Association, Include, Extend,
Generalization) Normal Flow of
Events Alternate/Exceptional Flows Entry
condition Exit condition Quality requirements
11Heuristics How do I find use cases?
- Select a narrow vertical slice of the system
(i.e. one scenario) - Discuss it in detail with the user to understand
the users preferred style of interaction - Select a horizontal slice (i.e. many scenarios)
to define the scope of the system. - Discuss the scope with the user
- Use illustrative prototypes (mock-ups) as visual
support - Find out what the user does
- Task observation (Good)
- Questionnaires (Bad)
12Guidelines for Creating Use-Case Descriptions
- The name of the use case should indicate what the
user tries to accomplish (use verb phrases, e.g.
ReportEmergency, OpenIncident, Allocate
resources) - In the Flow of events, write each step in
Subject-Verb-Direct Object - The patient contacts the office regarding an
appointment - Clarify initiator and receivers of action
- Write from independent observer perspective
- Patient provides the Receptionist with their
names - Write at same level of abstraction
- Ensure a sensible set of steps
- Apply KISS principle liberally no more than 2
pages per use case - Write repeating instructions after the set of
steps to be repeated.
13Use Case Example ReportEmergency
- Use case name ReportEmergency
- Participating Actors
- Field Officer (Bob and Alice in the Scenario)
- Dispatcher (John in the Scenario)
- Flow of Events on next slide.
- Exceptions
- The FieldOfficer is notified immediately if the
connection between her terminal and the central
is lost. - The Dispatcher is notified immediately if the
connection between any logged in FieldOfficer and
the central is lost. - Special Requirements
- The FieldOfficers report is acknowledged within
30 seconds. The selected response arrives no
later than 30 seconds after it is sent by the
Dispatcher.
14Use Case Example ReportEmergencyFlow of Events
- The FieldOfficer activates the Report Emergency
function of her terminal. SYSTEM responds by
presenting a form to the officer. - The FieldOfficer fills the form, by selecting the
emergency level, type, location, and brief
description of the situation. The FieldOfficer
also describes possible responses to the
emergency situation. Once the form is completed,
the FieldOfficer submits the form, at which
point, the Dispatcher is notified. - The Dispatcher reviews the submitted information
and creates an Incident in the database by
invoking the OpenIncident use case. The
Dispatcher selects a response and acknowledges
the emergency report. - The FieldOfficer receives the acknowledgment and
the selected response.
15Another Use Case Example Allocate a Resource
- Actors
- Field Supervisor This is the official at the
emergency site.... - Resource Allocator The Resource Allocator is
responsible for the commitment and decommitment
of the Resources managed by the SYSTEM. ... - Dispatcher A Dispatcher enters, updates, and
removes Emergency Incidents, Actions, and
Requests in the system. The Dispatcher also
closes Emergency Incidents. - Field Officer Reports accidents from the Field
16Another Use Case Example Allocate a Resource
- Use case name AllocateResources
- Participating Actors
- Field Officer (Bob and Alice in the Scenario)
- Dispatcher (John in the Scenario)
- Resource Allocator
- Field Supervisor
- Entry Condition
- The Resource Allocator has selected an available
resource. - The resource is currently not allocated
- Flow of Events
- The Resource Allocator selects an Emergency
Incident. - The Resource is committed to the Emergency
Incident. - Exit Condition
- The use case terminates when the resource is
committed. - The selected Resource is now unavailable to any
other Emergency Incidents or Resource Requests. - Special Requirements
- The Field Supervisor is responsible for managing
the Resources
17Another example Make appointment(see textbook,
figure 6-4)
- Use Case Name Make appointment ID 1 Importance
Level High - Primary Actor Patient Use Case Type Essential
- Stakeholders and Interests
- Patient-wants to make an appointment
- Doctor-wants to ensure that patients needs are
met in a timely manner - Brief Description This use case describes how to
make, change, cancel appointments - Trigger Patient calls to make, change, cancel
appointments - Relationships (Association, Include, Extend,
Generalization) - Normal Flow of Events
- The Patient contacts the office to make an
appointment - The Patient provides the Receptionist with the
name and address - The Receptionist validates that the Patient
exists in the database.
18Order of steps when formulating use cases
- First step name the use case
- Use case name ReportEmergency
- Second step Find the actors
- Generalize the concrete names (Bob) to
participating actors (Field officer) - Participating Actors
- Field Officer (Bob and Alice in the Scenario)
- Dispatcher (John in the Scenario)
- Third step Then concentrate on the flow of
events - Use informal natural language
19Your turn What is wrong with this?
- Use Case Name Accident ID Importance Level
- Primary Actor Bob Use Case Type
- Normal Flow of Events
- 1. The FieldOfficer reports the accident
- 2. An Ambulance is dispatched
- 3. The Dispatcher is notified when the ambulance
arrives at site
20Use Case Diagrams
21Syntax for Use-Case Diagram
22The Use-Case Diagram for Appointment System
23Use-Case Diagram with Specialized Actor
24Use Case Associations
- A use case model consists of use cases and use
case associations - A use case association is a relationship between
use cases - Important types of use case associations
Include, Extends, Generalization - Include
- A use case uses another use case (functional
decomposition) - Extends
- A use case extends another use case
- Generalization
- An abstract use case has different specializations
25Example Use Case Diagram for Incident Management
Dispatcher
FieldOf
f
icer
OpenIncident
ReportEmergency
AllocateResources
26ltltIncludegtgt Functional Decomposition
- Problem
- A function in the original problem statement is
too complex to be solvable immediately - Solution
- Describe the function as the aggregation of a
set of simpler functions. The associated use case
is decomposed into smaller use cases
27ltltIncludegtgt Reuse of Existing Functionality
- Problem
- There are already existing functions. How can we
reuse them? - Solution
- The include association from a use case A to a
use case B indicates that an instance of the use
case A performs all the behavior described in the
use case B (A delegates to B) - Example
- The use case ViewMap describes behavior that
can be used by the use case OpenIncident
(ViewMap is factored out)
Base Use Case
Supplier Use Case
Note The base case cannot exist alone. It is
always called with the supplier use case
28ltExtendgtgt Association for Use Cases
- Problem
- The functionality in the original problem
statement needs to be extended. - Solution
- An extend association from a use case A to a use
case B indicates that use case B is an extension
of use case A. - Example
- The use case ReportEmergency is complete by
itself , but can be extended by the use case
Help for a specific scenario in which the user
requires help
Note The base use case can be executed without
the use case extension in extend associations.
29Generalization association in use cases
- Problem
- You have common behavior among use cases and want
to factor this out. - Solution
- The generalization association among use cases
factors out common behavior. The child use cases
inherit the behavior and meaning of the parent
use case and add or override some behavior. - Example
- Consider the use case ValidateUser, responsible
for verifying the identity of the user. The
customer might require two realizations
CheckPassword and CheckFingerprint
Parent Case
Child Use Case
30Extend and Include Relationships for the
Appointment System
31Your turn How Would You Read This Diagram?
32Use case model drives the work from analysis
through test
Verified by
Realized by
Implemented by
33Further reading
- Book Writing Effective Use Cases by Alistair
Cockburn (Addison-Wesley, 2000) - For a use case description template and other
materials see http//www.usecases.org/
34Activity Diagrams
35What Is an Activity Diagram?
- An activity diagram in the use-case model can be
used to capture the activities and actions
performed in a use case. - It is essentially a flow chart, showing flow of
control from one activity or action to another.
Flow of Events This use case starts when the
Registrar requests that the system close
registration. 1. The system checks to see if
registration is in progress. If it is, then a
message is displayed to the Registrar and the use
case terminates. The Close Registration
processing cannot be performed if registration is
in progress. 2. For each course offering, the
system checks if a professor has signed up to
teach the course offering and at least three
students have registered. If so, the system
commits the course offering for each schedule
that contains it.
Activity 2
Activity 1
Activity 3
36What Is an Activity?
- A specification of behavior expressed as a flow
of execution via sequencing of subordinate units. - Subordinate units include nested activities and
ultimately individual actions. - May contain boolean expression constraints when
the activity is invoked or exited
Activity 2
Activity 4
Activity 5
37Example Activity Diagram
38Appointment System Example
39Creating Activity Diagrams
- 1. Since an activity diagram can be used to model
any kind of process, you should set the context
or scope of the activity being modeled. - 2. Once you have determined the scope, you should
give the diagram an appropriate title. - 3. You must identify the activities, control
flows, and object flows that occur between the
activities. - 4. You should identify any decisions that are
part of the process being modeled. - 5. You should attempt to identify any prospects
for parallelism in the process. - 6. You should draw the activity diagram.
40Summary
- The requirements process consists of requirements
elicitation and analysis. - Scenarios
- Great way to establish communication with client
- Different types of scenarios As-Is, visionary,
evaluation and training - Use cases Abstraction of scenarios
- Use case descriptions
- Use case diagrams
41Summary How to Specify a Use Case
- Name of Use Case
- Actors
- Description of Actors involved in use case)
- Entry condition
- This use case starts when
- Flow of Events
- Free form, informal natural language
- Exit condition
- This use cases terminates when
- Exceptions
- Describe what happens if things go wrong
- Special Requirements
- Nonfunctional Requirements, Constraints)
42Summary Activity Diagrams
- Can model business processes, methods
- Capture the control and object flow in a business
process