CH 04
CH 04
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 3
Software Lifecycle Definition
Software lifecycle:
Set of activities and their relationships to each other to support the
development of a software system
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 4
Example: Selection of Software Lifecycle Activities
for a specific project
Implemen-
tation
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 5
Software Lifecycle Activities
Implemented
Expressed in By
Structured By Realized By
Terms Of Verified
By
class...
class...
class... ?
class.... ?
Use Case Application Solution
Domain SubSystems Source Test
Model Domain
Objects Code Cases
Objects
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 6
First Step in Establishing the Requirements:
System Identification
The development of a system is not just done by taking a
snapshot of a scene (domain)
Two questions need to be answered:
How can we identify the purpose of a system?
Crucial is the definition of the system boundary: What is inside,
what is outside the system?
These two questions are answered in the requirements process
The requirements process consists of two activities:
Requirements Elicitation:
Definition of the system in terms understood by the customer
(“Problem Description”)
Requirements Analysis:
Technical specification of the system in terms understood by the
developer (“Problem Specification”)
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 7
Defining the System Boundary is Often Difficult
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 8
Products of Requirements Process (Activity Diagram)
Problem
Statement Problem
Statement
Generation
Requirements
Elicitation
system
specification:
Model
Requirements
Analysis
analysis
model: Model
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 9
Requirements Elicitation
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 10
System Specification vs Analysis Model
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 11
Problem Statement
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 12
Ingredients of a Problem Statement
Current situation: The Problem to be solved
Description of one or more scenarios
Requirements
Functional and Nonfunctional requirements
Constraints (“pseudo requirements”)
Project Schedule
Major milestones that involve interaction with the client including deadline
for delivery of the system
Target environment
The environment in which the delivered system has to perform a specified
set of system tests
Client Acceptance Criteria
Criteria for the system tests
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 13
Current Situation: The Problem To Be Solved
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 14
ARENA: The Problem
The Internet has enabled virtual communities
Groups of people sharing common of interests but who have never met each
other in person. Such virtual communities can be short lived (e.g people in a
chat room or playing a multi player game) or long lived (e.g., subscribers to a
mailing list).
Many multi-player computer games now include support for virtual
communities.
Players can receive news about game upgrades, new game levels, announce
and organize matches, and compare scores.
Currently each game company develops such community support in each
individual game.
Each company uses a different infrastructure, different concepts, and
provides different levels of support.
This redundancy and inconsistency leads to problems:
High learning curve for players joining a new community,
Game companies need to develop the support from scratch
Advertisers need to contact each individual community separately.
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 15
ARENA: The Objectives
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 16
Types of Requirements
Functional requirements:
Describe the interactions between the system and its environment
independent from implementation
Examples:
An ARENA operator should be able to define a new game.
Nonfunctional requirements:
User visible aspects of the system not directly related to functional
behavior.
Examples:
The response time must be less than 1 second
The ARENA server must be available 24 hours a day
Constraints (“Pseudo requirements”):
Imposed by the client or the environment in which the system operates
The implementation language must be Java
ARENA must be able to dynamically interface to existing games provided by
other game developers.
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 17
What is usually not in the requirements?
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 18
Requirements Validation
Requirements validation is a critical step in the development process, usually after
requirements engineering or requirements analysis. Also at delivery (client acceptance
test).
Requirements validation criteria:
Correctness:
The requirements represent the client’s view.
Completeness:
All possible scenarios, in which the system can be used, are described,
including exceptional behavior by the user or the system
Consistency:
There are functional or nonfunctional requirements that contradict each other
Realism:
Requirements can be implemented and delivered
Traceability:
Each system function can be traced to a corresponding set of functional requirements
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 19
Requirements Validation
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 20
Types of Requirements Elicitation
Greenfield Engineering
Development starts from scratch, no prior system exists, the
requirements are extracted from the end users and the client
Triggered by user needs
Example: Develop a game from scratch: Asteroids
Re-engineering
Re-design and/or re-implementation of an existing system using
newer technology
Triggered by technology enabler
Example: Reengineering an existing game
Interface Engineering
Provide the services of an existing system in a new environment
Triggered by technology enabler or new market needs
Example: Interface to an existing game (Bumpers)
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 21
Scenarios
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 22
Types of Scenarios
As-is scenario:
Used in describing a current situation. Usually used in re-engineering projects.
The user describes the system.
Example: Description of Letter-Chess
Visionary scenario:
Used to describe a future system. Usually used in greenfield engineering and
reengineering projects.
Can often not be done by the user or developer alone
Example: Description of an interactive internet-based Tic Tac Toe game
tournament.
Evaluation scenario:
User tasks against which the system is to be evaluated.
Example: Four users (two novice, two experts) play in a TicTac Toe tournament in
ARENA.
Training scenario:
Step by step instructions that guide a novice user through a system
Example: How to play Tic Tac Toe in the ARENA Game Framework.
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 23
How do we find scenarios?
Don’t expect the client to be verbal if the system does not exist
(greenfield engineering)
Don’t wait for information even if the system exists
Engage in a dialectic approach (evolutionary, incremental
engineering)
You help the client to formulate the requirements
The client helps you to understand the requirements
The requirements evolve while the scenarios are being developed
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 24
Heuristics for finding Scenarios
Ask yourself or the client the following questions:
What are the primary tasks that the system needs to perform?
What data will the actor create, store, change, remove or add in the
system?
What external changes does the system need to know about?
What changes or events will the actor of the system need to be
informed about?
However, don’t rely on questionnaires alone.
Insist on task observation if the system already exists (interface
engineering or reengineering)
Ask to speak to the end user, not just to the software contractor
Expect resistance and try to overcome it
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 25
Example: Accident Management System
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 26
Scenario 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.
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 27
Observations 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
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 28
Next 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
Example: “Report Emergency “ in the first paragraph of the
scenario is a candidate for a use case
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 29
Use Cases
ReportEmergency
Use Case Model: The set of all use cases specifying the
complete functionality of the system
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 30
Example: Use Case Model for Incident Management
Dispatcher
FieldOf ficer OpenIncident
ReportEmergency
AllocateResources
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 31
Heuristics: How do I find use cases?
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 32
Use Case Example: ReportEmergency
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 33
Use Case Example: ReportEmergency
Flow of Events
The FieldOfficer activates the “Report Emergency” function of her
terminal. FRIEND 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.
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 34
Another Use Case Example: Allocate a Resource
Actors:
Field Supervisor: This is the official at the emergency site....
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 35
Another 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
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 36
Order of steps when formulating use cases
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 37
Use Case Associations
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 38
<<Include>>: 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
ManageIncident
<<include>>
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 39
<<Include>>: 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)
<<include>>
OpenIncident
ViewMap
Base Use
Case <<include>>
Supplier
AllocateResources Use Case
Note: The base case cannot exist alone. It is always called with the
supplier use case
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 40
<Extend>> 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
Help
FieldOfficer
f
<<extend>>
ReportEmergency
Note: The base use case can be executed without the use case extension
in extend associations.
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 41
Generalization 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”
CheckPassword
Parent
ValidateUser Child
Case
CheckFingerprint Use Case
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 42
From Use Cases to Objects
Level 1 Top Level Use Case
Operations
Level 4 Level 4
A B A and B
are called
Participating
Objects
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 43
Use Cases can be used by more than one object
Level 1 Top Level Use Case
Operations
Level 4 Level 4
A B
Participating
Objects
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 44
How to Specify a Use Case (Summary)
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)
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 45
Summary
The requirements process consists of requirements elicitation and analysis.
The requirements elicitation activity is different for:
Greenfield Engineering, Reengineering, Interface Engineering
Scenarios:
Great way to establish communication with client
Different types of scenarios: As-Is, visionary, evaluation and training
Use cases: Abstraction of scenarios
Pure functional decomposition is bad:
Leads to unmaintainable code
Pure object identification is bad:
May lead to wrong objects, wrong attributes, wrong methods
The key to successful analysis:
Start with use cases and then find the participating objects
If somebody asks “What is this?”, do not answer right away. Return the
question or observe the end user: “What is it used for?”
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 46