Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Requirement
Engineering
250
200
150
100
50
0
ng
t
g
lity
en
sig
in
di
m
st
bi
De
Co
Te
i
ire
as
qu
Fe
Re
Development Phases
Construction Project
Process Tracking
Software
Requirements
User Change
Documentation Control
System
Testing
Levels of Requirements
• Business Requirements
– Represent high level objectives of the
organization or customer requesting
the system or product
– Captured in a document describing
the project vision and scope.
• User Requirements
– Describes tasks the user must be able
to accomplish
4.5 Types of Requirements
• Functional requirements
– Describe what the system should do
– Define the software functionality the
developers must build into the product to
enable users to accomplish their tasks -
thereby satisfying the business
requirements.
• Non-functional requirements
– Constraints or restrictions that are placed
on the choices available to the developer for
design and construction of the software
product.
© Lethbridge/Laganière Chapter 4: Developing
18
2001 requirements
Functional requirements
– What inputs the system should accept
– What outputs the system should
produce
– What data the system should store that
other systems might use
– What computations the system should
perform
– The timing and synchronization of the
above
P r o v id e s B u s in e s s S p e c ifie s H ig h L e v e l
R e q u i r e m e n t s a n d P r o je c t R e q u ir e m e n ts
P a ra m e te rs
S o ftw a re
R e q u ire m e n ts
s p e c ifie s h a rd w a r e
a llo c a te s s y s te m
in te r fa c e s th e s o ftw a r e m u s t
re q u ir e m e n ts to s o ftw a r e
re s p e c t
d e s c r ib e u s e r
r e q u ir e m e n ts a n d q u a lity
a ttr ib u te s
S y s te m s H a rd w a re
E n g in e e r in g E n g in e e r in g
U s e rs
Stake holders - User classes
• A study of over 8300 projects revealed
that the top two reasons for any project
failure are lack of user input and
incomplete requirements.
• Example of menu driven system for
power users
– supposed to replace the existing system
but failed because of this reason.
Example of minimal
requirements
• We need a flow control and source
control engineering tool.
• Worked perfectly but
– There was no print functionality
Example of minimal
requirements
• The system should maintain the
hourly level of reservoir from depth
sensor situated in the reservoir. The
values should be stored for the past
six months.
• AVERAGE: Average command
displays the average water level for a
particular sensor between two times.
Ambiguous requirements
• Ambiguity – arising from natural
language
– Sommerville – no output is better
than wrong output.
– Rooko mut jane do
• Leads to different expectations
• Waste of time and effort
Ambiguous requirements
• Multiple readers arrive at different
understanding
– The operator identity consists of the
operator name and password; the
password consists of six digits. It
should be displayed on the security
VDU and deposited in the login file
when an operator logs into the
system
Ambiguous Requirements
• System should be user friendly
• System should have a good user
interface
• It should perform operations
efficiently
• It should respond to queries quickly
Contradiction
• All programs must be written in Ada
• The program must fit in the memory
of the embedded micro-controller
• Problem: Code generated by the Ada
compiler was of large foot print – it
would not fit.
Contradiction
• System must monitor all
temperatures in a chemical reactor.
• System should only monitor and log
temperatures below -200 C and
above 4000 C.
Some Risks From
Inadequate Requirement
Process
• Insufficient user involvement leads to unacceptable
products.
• Creeping user requirements contribute to overruns
and degrade product quality.
• Ambiguous requirements lead to ill-spent time and
rework.
• Minimal specifications lead to missing key
requirements.
• Overlooking the needs of certain user classes
(stake holders) leads to dissatisfied customers.
• Incompletely defined requirements make accurate
project planning and tracking impossible.
• Gold-plating by developers and users adds
User Centred Design
• Software development should focus on the
needs of users
– Understand your users
– Design software based on an understanding of
the users’ tasks
– Ensure users are involved in decision making
processes
– Design the user interface following guidelines
for good usability
– Have users work with and give their feedback
about prototypes, on-line help and draft user
manuals
The importance of focusing
on users
– Reduced training and support costs
– Reduced time to learn the system
– Greater efficiency of use
– Reduced costs by only developing features that
are needed
– Reduced costs associated with changing the
system later
– Better prioritizing of work for iterative
development
– Greater attractiveness of the system, so users
will be more willing to buy and use it
Characteristics of Users
• Software engineers must develop an
understanding of the users
– Goals for using the system
– Potential patterns of use
– Demographics
– Knowledge of the domain and of
computers
– Physical ability
– Psychological traits and emotional
feelings
Use Cases
• Used to describe the outwardly
visible requirements
Order Processing Problem
Statement
• Problem Description
– We are developing order processing software for a mail
order company called National Widgets, which is a
reseller of products purchased from various suppliers.
– Twice a year the company publishes a catalog of
products, which is mailed to customers and other
interested people.
– Customers purchase products by submitting a list of
products with payment to National Widgets. National
Widgets fills the order and ships the products to the
customer’s address.
– The order processing software will track the order from
the time its is received until the product is shipped.
– National Widgets will provide quick service . They
should be able to ship a customer’s order by the
fastest, most efficient means possible.
– Customers may return items but will sometimes pay a
fee.
• Assumptions
– An electronic interface, such as web, would be good for
some customers.
Identifying System
Boundaries
• Finding out what things are inside –
you have to worry about creating
them, and what things are outside –
you don’t have to create them but
have to worry about interfacing with
them.
What is the boundary of this
system?
National widgets will need to ship orders to customers.
Shipping needs to include packaging and labeling
orders, weighing them, and determining postage based
on shipping method, speed of delivery, insurance,
weight, destination, and so on.
At various points in
the project we need
to compare these
diagrams to remove
redundancies and to
keep them
Scenarios
• Each use case must include details about
what has to be done to accomplish the
functionality of the use case.
– basic functionality
– alternative paths
– error conditions
– pre-condition: a condition that must be true
before starting
– post-condition: a condition that must be true
at the end.
• The use case may contain conditionals,
branching, and loops.
Scenarios
• A scenario is an instance of a use
case
– It expresses a specific occurrence of the
use case
• a specific actor ...
• at a specific time ...
• with specific data.
Scenarios
• Scenarios are written from an actor’s point
of view.
• Each scenario is a sequence of events that
describes the functionality of the use case.
• It can be thought of as a list of steps to go
through to accomplish the use case.
• The primary scenario is written as if
everything goes right.
• There must be one primary scenario for
each use case.
• Use cases are built iteratively.
Place Order Use Case
Pre-condition: 1. The customer will enter
A valid user has logged into credit card payment
information.
the system
2. The customer will select
Flow of Events: submit.
Basic Path: 3. The system will verify
1. The use case starts the information, save
when the customer the order as pending,
selects place order. and forward the
2. The customer enters payment information to
his/her name and the accounting system.
address 4. When payment is
3. If the customer enters confirmed, the order is
only the zip code the marked Confirmed, an
system will supply the order ID is returned to
city and the state. the customer, and the
4. The customer will enter use case end.
product codes for
desired products. lternative Path:
5. The system will supply a
product description and
Showing Alternatives with
Branching
• Find Order Use Case
Flow of Events:
– The user may enter an order ID, customer ID,
or customer name.
– The user will press find.
– If the user entered an order ID
a) The system will display the order.
4. If the user entered a customer name or
customer ID
a) The system will return a list of all orders for
that customer.
b) The user will select one order from the list
c) The system will display the order
Repetition
Flow of Events: 1. The customer will enter
credit card payment
Basic Path:
information.
– The use case starts when
2. The customer will select
the customer selects place
submit.
order.
– 3. The system will verify the
The customer enters
information, save the order
his/her name and address
as pending, and forward
– If the customer enters only the payment information to
the zip code the system will the accounting system.
supply the city and the
4. When payment is
state.
confirmed, the order is
– The customer will enter marked Confirmed, an
product codes for desired order ID is returned to the
products. customer, and the use case
– For each product code end.
entered
• The system will
supply a product
description and the
price for each item.
Repetition
Flow of Events: 1. The customer will enter
credit card payment
Basic Path:
information.
– The use case starts when
2. The customer will select
the customer selects place
submit.
order.
– 3. The system will verify the
The customer enters
information, save the order
his/her name and address
as pending, and forward
– If the customer enters only the payment information to
the zip code the system will the accounting system.
supply the city and the
4. When payment is
state.
confirmed, the order is
– The customer will enter marked Confirmed, an
product codes for desired order ID is returned to the
products. customer, and the use case
– While the customer end.
enters product codes
• The system will supply a
product description and
the price for each item.
• The system will add the
Alternative Paths
Flow of Events: 1. The customer will enter
credit card payment
Basic Path:
information.
1. The use case starts when
2. The customer will select
the customer selects place
submit.
order.
3. The system will verify the
2. The customer enters
information, save the order
his/her name and address
as pending, and forward
3. If the customer enters only the payment information to
the zip code the system will the accounting system.
supply the city and the
4. When payment is
state.
confirmed, the order is
4. The customer will enter marked Confirmed, an
product codes for desired order ID is returned to the
products. customer, and the use case
5. While the customer enters end.
product codes
• The system will supply a lternative Paths
product description and
the price for each item.
At any time before selecting
• The system will add the
Other alternative scenarios
• Is there any difference between the
way the customer and the sales rep
interact with the system?
• Are there any other error conditions?
– an order arrives that is missing a
payment.
– an order arrives that is missing a
shipping address.
Place Order Use Case
Pre-condition:
Flow of Events:
Basic Path:
Alternative Paths:
Post Condition:
Special Requirements:
The system must always respond to the
user input within one second.
Presentation Styles
• Cancel Order Use Case
• Primary Scenario
When the customer rep receives a
request to cancel order, the
customer rep finds the order in the
system and marks it cancelled. Then
a request is sent to the accounting
system to credit the customer’s
account.
Presentation Styles
• Cancel Order Use Case
• Primary Scenario
1. The use case begins when a customer rep
receives a request to cancel order.
2. The customer rep enters the order ID
3. The customer rep presses find
4. The system will display the order
5. The customer rep presses cancel-order
6. The system marks the order cancelled
7. The accounting system is notified to credit the
customer’s account and the use case ends.
Secondary Scenarios
• To completely define a use case we
need to identify scenarios for
alternative paths and scenarios for
error conditions
• These can be added to the basic path
or written as secondary scenarios.
Place Order Secondary
Scenarios
• Payment not there
• order incomplete
• order gets lost
• customer can’t login
• shipping address is incomplete
• product code does not match actual products
• product no longer carried
• payment bad
• customer pays by check
• customer sends order by mail
• customer phones in order
Dependencies
<<extend>> and <<include>>
Stereotypes
• Extend dependencies are used when we have an
optional sequence of events we want to include in
the use case.
• Used to make optional interactions explicit or to
handle exceptional cases.
• By creating separate use case extensions, the
description of the basic use case remains simple.
• A use case extension must list all the steps from
the beginning of the use case to the end.
– Including the handling of the unusual situation.
Dependencies
<<extend>> Stereotypes
• Determine what should be added and where it
should be added.
• More than one use case can extend from the same
point.
• More than one extension can be executed from the
same point.
• When the extension point is reached, the
conditions for all the extending use cases for that
point are evaluated.
• Every extension with a true condition is executed.
• The order of evaluation of the extending use cases
is undefined.
Place Order Use Case
Flow of Events: 1. The customer will enter
credit card payment
Basic Scenario:
information.
1. The use case starts
2. The customer will select
when the customer
submit.
selects place order.
3. The system will verify
2. The customer enters
the information, save
his/her name and
the order as pending,
address
and forward the
3. The customer will enter payment information to
product codes for the accounting system.
desired products.
4. When payment is
4. The system will supply a confirmed, the order is
product description and marked Confirmed, an
the price for each item. order ID is returned to
5. The system will keep the customer, and the
running
We need total
to add a of items
requirements to: use case end.
ordered
2. offer salesason
they are
various Place Order
entered.
merchandise on various items
___________
Sale Item , before step 5
3. offer special discounts to Frequent customer , before step 6
frequent customers
Extending Use Case Seasonal
Sale Price
If product in Seasonal sale list then
Sale Item Extension
1. The system will get the sale discount
for the product
2. The system will display the discount on
the order
3. The system will calculate a discount
amount
4. The system will subtract the discount
amount from the order total
Extending Use Case Frequent
Customer Discount
If the customer in Special Customer list
then
Special Customer Extension
1. The system will get the customer
discount
2. The system will display the discount on
the order
3. The system will calculate the discount
amount
4. The system will subtract the discount
Extending Use Case Overstock
Product Sale
If product in Overstock list and amount
of product on hand > maximum
stock level them
Sale Item Extension
1. The system will get the sale discount
for the product
2. The system will display the discount on
the order
3. The system will calculate a discount
amount
4. The system will subtract the discount
If the product is
overstocked and is
also on sale then it
will be discounted
twice!
Is the order
important?
<<include>>
• Reuse the common behavior
Flow of Events:
1. The user may enter an order ID, customer ID,
or customer name.
2. The user will press find.
3. If the user entered an order ID
a) The system will display the order.
4. If the user entered a customer name or
customer ID
a) The system will return a list of all orders for that
customer.
b) The user will select one order from the list
c) The system will display the order
Cancel Order Use Case
– The use case begins when a customer rep
receives a request to cancel order.
– The customer rep enters the order ID
– The customer rep presses find
– The system will display the order
– If the order status is Confirmed
a) The order is marked Cancelled
b) The accounting system is notified to credit
the customer’s account and the use case
ends.
6. If the order status is Shipped
a) The customer is notified of NW’s return
policy
Cancel Order Use Case
– The use case begins when a customer rep
receives a request to cancel order.
– <<include>> Find Order.
– If the order status is Confirmed
a) The order is marked Cancelled
b) The accounting system is notified to credit
the customer’s account and the use case
ends.
4. If the order status is Shipped
a) The customer is notified of NW’s return
policy
Generalization
• Much like super-classes in a class diagram.
• A generalized use case represents several
similar use cases.
• One or more specializations provides
details of the similar use cases.
• Mostly used between actors.
• Generalization between actors means that
one actor fills the same roles as another
actor.
• It also may fill additional roles.
Example of generalization, extension
and inclusion
Open file
Ordinary User
«extend» «include»