Software Requirements - National Chung Cheng University

Download Report

Transcript Software Requirements - National Chung Cheng University

Chapter 3
Requirements Engineering
An overview of software requirements and
requirements engineering
1
Objectives




To introduce the concepts of user and system
requirements
To describe functional and non-functional
requirements
To explain how software requirements may be
organised in a requirements document
To describe requirements engineering, related
activities and processes
2
Topics covered







Functional and non-functional requirements
User requirements
System requirements
Interface specification
The software requirements document
Requirements engineering activities
Requirements engineering processes
3
Requirements engineering


The process of establishing the services that the
customer requires from a system and the
constraints under which it operates and is
developed.
The requirements themselves are the
descriptions of the system services and
constraints that are generated during the
requirements engineering process.
4
What is a requirement?


It may range from a high-level abstract statement
of a service or of a system constraint to a detailed
mathematical functional specification.
This is inevitable as requirements may serve a
dual function



May be the basis for a bid for a contract - therefore
must be open to interpretation;
May be the basis for the contract itself - therefore must
be defined in detail;
Both these statements may be called requirements.
5
Requirements abstraction (Davis)
“If a company wishes to let a contract for a large software development project, it
must define its needs in a sufficiently abstract way that a solution is not pre-defined.
T he requi rements must be written so that several contractors can bid for the contract,
offering, perhaps, different ways of meeting the client organisation’s needs. Once a
contract has been awarded, the contractor must write a system definition for the client
in more detail so that the client understands and can validate what the software will
do. Both of these documents may be called the requirements document for the
system.”
6
Types of requirement

User requirements


Statements in natural language plus diagrams of the
services the system provides and its operational
constraints. Written for customers.
System requirements

A structured document setting out detailed descriptions
of the system’s functions, services and operational
constraints. Defines what should be implemented so
may be part of a contract between client and contractor.
7
Definitions and specifications
User requ ir emen t defin itio n
1 . Th e s oftw ar e m u st p rov ide a mean s o f rep res en tin g an d
1 . accessing e x tern al files cr ea ted b y other to ols .
System req uir emen ts sp ecification
1 .1
1 .2
1 .2
1 .2
1 .3
1 .2
1 .4
1 .2
1 .5
1 .2
1 .2
Th e u ser s ho uld b e p r ov ided with facilities to d efine th e ty p e o f
ex ternal files .
Each e x tern al file typ e ma y have an as so cia ted too l w h ich ma y be
ap plied to the file .
Each e x tern al file typ e ma y be rep r es en ted as a sp ecific icon o n
the us er’ s dis play.
Facilities s ho uld b e p r o v ided fo r th e ico n r ep res en tin g an
ex tern al file typ e to b e defin ed b y th e u ser.
When a us er selects an ico n r ep r es en tin g an e x tern al file, the
effect of that s election is to ap p ly the to ol as so ciated with th e typ e of
the ex ternal file to the file rep res en ted b y the selected icon .
8
Requirements readers
9
Functional and non-functional requirements

Functional requirements


Non-functional requirements


Statements of services the system should provide, how the
system should react to particular inputs and how the system
should behave in particular situations.
constraints on the services or functions offered by the system
such as timing constraints, constraints on the development
process, standards, etc.
Domain requirements

Requirements that come from the application domain of the
system and that reflect characteristics of that domain.
10
Functional requirements



Describe functionality or system services.
Depend on the type of software, expected users
and the type of system where the software is
used.
Functional user requirements may be high-level
statements of what the system should do but
functional system requirements should describe
the system services in detail.
11
The LIBSYS system


A library system that provides a single interface to
a number of databases of articles in different
libraries.
Users can search for, download and print these
articles for personal study.
12
Examples of functional requirements

The user shall be able to search either all of the
initial set of databases or select a subset from it.

The system shall provide appropriate viewers for
the user to read documents in the document
store.

Every order shall be allocated a unique identifier
(ORDER_ID) which the user shall be able to copy
to the account’s permanent storage area.
13
Requirements imprecision



Problems arise when requirements are not
precisely stated.
Ambiguous requirements may be interpreted in
different ways by developers and users.
Consider the term ‘appropriate viewers’


User intention - special purpose viewer for each
different document type;
Developer interpretation - Provide a text viewer that
shows the contents of the document.
14
Requirements completeness and consistency




In principle, requirements should be both complete and
consistent.
Complete
 They should include descriptions of all facilities
required.
Consistent
 There should be no conflicts or contradictions in the
descriptions of the system facilities.
In practice, it is impossible to produce a complete and
consistent requirements document.
15
Non-functional requirements



These define system properties and constraints
e.g. reliability, response time and storage
requirements. Constraints are I/O device
capability, system representations, etc.
Process requirements may also be specified
mandating a particular CASE system,
programming language or development method.
Non-functional requirements may be more critical
than functional requirements. If these are not met,
the system is useless.
16
Non-functional classifications

Product requirements


Organisational requirements


Requirements which specify that the delivered product must
behave in a particular way e.g. execution speed, reliability, etc.
Requirements which are a consequence of organisational
policies and procedures e.g. process standards used,
implementation requirements, etc.
External requirements

Requirements which arise from factors which are external to the
system and its development process e.g. interoperability
requirements, legislative requirements, etc.
17
Non-functional requirement types
Non-functi ona l
requir ements
Produc t
requir ements
E ffi cie ncy
requir ements
Rel iabi lity
requir ements
Usa bi lity
requir ements
Perfor manc e
requir ements
Orga nisationa l
requir ements
Porta bi lity
requir ements
Deli very
requir ements
Spac e
requir ements
E xte rna l
requir ements
Inter oper a bi lity
requir ements
Impl ement a ti on
requir ements
E thic al
requir ements
St andar ds
requir ements
Pri vac y
requir ements
L egislative
requir ements
Sa fet y
requir ements
18
Non-functional requirements examples

Product requirement
8.1 The user interface for LIBSYS shall be implemented as simple
HTML without frames or Java applets.

Organisational requirement
9.3.2 The system development process and deliverable
documents shall conform to the process and deliverables
defined in XYZCo-SP-STAN-95.

External requirement
7.6.5 The system shall not disclose any personal information
about customers apart from their name and reference number to
the operators of the system.
19
Requirements measures
Property
Measure
Speed
Processed transactions/second
User/Event response time
Screen refresh time
Size
M Bytes
Numb er of ROM chips
Ease of use
Training time
Numb er of h elp frames
Reliability
Mean time to failure
Probability of unavailability
Rate of failure occurrence
Availability
Robustness
Time to restart after failure
Percentage of events causing failure
Probability of data corruption on failure
Portability
Percentage of target dependent statements
Numb er of target systems
20
Requirements interaction


Conflicts between different non-functional
requirements are common in complex systems.
Spacecraft system



To minimise weight, the number of separate chips in
the system should be minimised.
To minimise power consumption, lower power chips
should be used.
However, using low power chips may mean that more
chips have to be used. Which is the most critical
requirement?
21
Domain requirements



Derived from the application domain and describe
system characteristics and features that reflect
the domain.
Domain requirements be new functional
requirements, constraints on existing
requirements or define specific computations.
If domain requirements are not satisfied, the
system may be unworkable.
22
Library system domain requirements

There shall be a standard user interface to all
databases which shall be based on the Z39.50
standard.

Because of copyright restrictions, some
documents must be deleted immediately on
arrival. Depending on the user’s requirements,
these documents will either be printed locally on
the system server for manually forwarding to the
user or routed to a network printer.
23
Train protection system

The deceleration
computed as:

of
the
train
shall
be
Dtrain = Dcontrol + Dgradient
where Dgradient is 9.81ms2 * compensated
gradient/alpha and where the values of
9.81ms2 /alpha are known for different types of
train.
24
Domain requirements problems

Understandability



Requirements are expressed in the language of the
application domain;
This is often not understood by software engineers
developing the system.
Implicitness

Domain specialists understand the area so well that
they do not think of making the domain requirements
explicit.
25
User requirements


Should describe functional and non-functional
requirements in such a way that they are
understandable by system users who don’t have
detailed technical knowledge.
User requirements are defined using natural
language, tables and diagrams as these can be
understood by all users.
26
Problems with natural language

Lack of clarity


Requirements confusion


Precision is difficult without making the document
difficult to read.
Functional and non-functional requirements tend to be
mixed-up.
Requirements amalgamation

Several different requirements may be expressed
together.
27
LIBSYS requirement
4..5 LIBSYS shall provide a financial accounting system
that maintains records of all payments made by users of
the system. System managers may configure this system
so that regular users may receive discounted rates.
28
Editor grid requirement
2.6 Grid facilities To assist in the positioning of entities on a diagram,
the user may turn on a grid in either centimetres or inches, via an
option on the control panel. Initially, the grid is off. The grid may be
turned on and off at any time during an editing session and can be
toggled between inches and centimetres at any time. A grid option
will be provided on the reduce-to-fit view but the number of grid
lines shown will be reduced to avoid filling the smaller diagram
with grid lines.
29
Requirement problems

Database requirements includes both conceptual and
detailed information



Describes the concept of a financial accounting system that is to
be included in LIBSYS;
However, it also includes the detail that managers can configure
this system - this is unnecessary at this level.
Grid requirement mixes three different kinds of
requirement



Conceptual functional requirement (the need for a grid);
Non-functional requirement (grid units);
Non-functional UI requirement (grid switching).
30
Structured presentation
2.6.1 Grid facilities
The editor shall provide a grid f acility where a m atrix of horizontal and
vertical lines provide a background to the editor window. This grid shall be a
passive grid where the alignment of entities is the user's responsibility.
Rationale: A grid helps the user to create a tidy diagram with well-spaced
entities. Although an active grid, where entities 'snap-to' grid lines can be useful,
the positioning is imprecise. The user is the best person to decide where entities
should be positioned.
Specification: ECLIPSE/WS/Tools/DE/FS Section 5.6
Source: Ray Wilson, Glasgow Off ice
31
Guidelines for writing requirements




Invent a standard format and use it for all
requirements.
Use language in a consistent way. Use shall for
mandatory requirements, should for desirable
requirements.
Use text highlighting to identify key parts of the
requirement.
Avoid the use of computer jargon.
32
System requirements




More detailed specifications of system functions,
services and constraints than user requirements.
They are intended to be a basis for designing the
system.
They may be incorporated into the system
contract.
System requirements may be defined or
illustrated using system models discussed in
Chapter 8.
33
Requirements and design


In principle, requirements should state what the
system should do and the design should describe
how it does this.
In practice, requirements and design are
inseparable



A system architecture may be designed to structure
the requirements;
The system may inter-operate with other systems that
generate design requirements;
The use of a specific design may be a domain
requirement.
34
Problems with NL specification

Ambiguity


Over-flexibility


The readers and writers of the requirement must
interpret the same words in the same way. NL is
naturally ambiguous so this is very difficult.
The same thing may be said in a number of different
ways in the specification.
Lack of modularisation

NL structures are inadequate to structure system
requirements.
35
Alternatives to NL specification
Notation
Descri ption
Struct ured natural
language
This approach depends on defining standard forms or templates to express the
requirements specificat ion.
Design
descript ion
languages
This approach uses a language like a programming language but wit h more abstract
features to specify the requirement s by defining an operat ional model of the system.
This approach is not now widely used although it can be useful for int erface
specifications.
Graphical
notat ions
A graphical language, supplemented by text annotat ions is used to define the
funct ional requirements for t he system. An early example of such a graphical
language was SADT. Now, use-case descript ions and sequence diagrams are
commonly used .
Mathemat ical
specifications
These are not ations based on mathemat ical concept s such as finite-state machines or
sets. These unambiguous specificat ions reduce the argument s between customer and
cont ractor about system funct ionality. However, most customers don’t understand
formal specificat ions and are reluctant to accept it as a system cont ract.
36
Structured language specifications




The freedom of the requirements writer is limited
by a predefined template for requirements.
All requirements are written in a standard way.
The terminology used in the description may be
limited.
The advantage is that the most of the
expressiveness of natural language is maintained
but a degree of uniformity is imposed on the
specification.
37
Form-based specifications






Definition of the function or entity.
Description of inputs and where they come from.
Description of outputs and where they go to.
Indication of other entities required.
Pre and post conditions (if appropriate).
The side effects (if any) of the function.
38
Form-based node specification
Insulin Pump/Control Software/SRS/3.3.2
Function
Compute insulin dose: Safe sugar level
Description
Computes the dose of insulin to be delivered w hen the current measured sugar level is in
the safe zone between 3 and 7 units.
Inputs Current sugar reading (r2), the previous two readings (r0 and r1)
Source Current sugar reading from sensor. Other readings from memory.
Outputs CompDose Š the dose in insulin to be delivered
Destination
Main control loop
Action: CompDose is zero if the sugar level is stable or falling or if the level is increasing but the rate of
increase is decreasing. If the level is increasing and the rate of increase is increasing, then CompDose is
computed by dividing the diff erence between the current sugar level and the previous level by 4 and
rounding the result. If the result, is rounded to zero then CompDose is set to the mi nimum dose that can
be delivered.
Requires
Two previous readings so that the rate of change of sugar level can be comp uted.
Pre-condition
The insulin reservoir contains at least the maximum allowed single dose of insulin..
Post-condition
r0 is replaced by r1 then r1 is replaced by r2
Side-effects
None
39
Tabular specification


Used to supplement natural language.
Particularly useful when you have to define a
number of possible alternative courses of action.
40
Tabular specification
Condition
Action
Sugar level falling (r2 < r1)
CompDose = 0
Sugar level stable (r2 = r1)
CompDose = 0
Sugar level increasing and rate of
increase decreasing ((r2-r1)<(r1-r0))
CompDose = 0
Sugar level increasing and rate of
increase stable or increasing. ((r2-r1) •
(r1-r0))
CompDose = round ((r2-r1)/4)
If rounded result = 0 then
CompDose = MinimumD ose
41
Graphical models


Graphical models are most useful when you need
to show how state changes or where you need to
describe a sequence of actions.
Different graphical models are explained in
Chapter 8.
42
Sequence diagrams



These show the sequence of events that take
place during some user interaction with a system.
You read them from top to bottom to see the
order of the actions that take place.
Cash withdrawal from an ATM



Validate card;
Handle request;
Complete transaction.
43
Sequence diagram of ATM withdrawal
ATM
Card
P IN reques t
Dat abase
Card number
Card OK
P IN
Validate card
Option menu
<<except ion>>
inval id card
Wit hdraw reques t
Amount reques t
Bal ance reques t
Bal ance
Handle request
Amount
Debi t (amount)
<<except ion>>
ins uffi ci ent cash
Debi t res ponse
Card
Card removed
Cas h
Complete
trans action
Cas h removed
Recei pt
44
Interface specification


Most systems must operate with other systems
and the operating interfaces must be specified as
part of the requirements.
Three types of interface may have to be defined




Procedural interfaces;
Data structures that are exchanged;
Data representations.
Formal notations are an effective technique for
interface specification.
45
PDL interface description
interface PrintServer {
// defines an abstract printer server
// requires:
interface Printer, interface PrintDoc
// provides: initialize, print, displayPrintQueue, cancelPrintJob, switchPrinter
void initialize ( Printer p ) ;
void print ( Printer p, PrintDoc d ) ;
void displayPrintQueue ( Printer p ) ;
void cancelPrintJob (Printer p , PrintDoc d) ;
void switchPrinter (Printer p1, Printer p2, PrintDoc d) ;
} //PrintServer
46
The requirements document



The requirements document is the official
statement of what is required of the system
developers.
Should include both a definition of user
requirements and a specification of the system
requirements.
It is NOT a design document. As far as possible,
it should set of WHAT the system should do
rather than HOW it should do it
47
Users of a requirements document
48
IEEE requirements standard

Defines a generic structure for a requirements
document that must be instantiated for each
specific system.





Introduction.
General description.
Specific requirements.
Appendices.
Index.
49
Requirements document structure










Preface
Introduction
Glossary
User requirements definition
System architecture
System requirements specification
System models
System evolution
Appendices
Index
50
Requirements analysis process
build a
prototype
the problem
requirements
elicitation
develop
specification
validation
management
create
analysis
models
51
Requirements engineering - I




Inception —ask a set of questions that establish …
 basic understanding of the problem
 the people who want a solution
 the nature of the solution that is desired, and
 the effectiveness of preliminary communication and
collaboration between the customer and the developer
Elicitation —elicit requirements from all stakeholders
Elaboration —create an analysis model that identifies data,
function and behavioral requirements
Negotiation —agree on a deliverable system that is realistic
for developers and customers
52
Requirements engineering - II



Specification —can be any one (or more) of the following:
 A written document
 A set of models
 A formal mathematical
 A collection of user scenarios (use-cases)
 A prototype
Validation —a review mechanism that looks for
 errors in content or interpretation
 areas where clarification may be required
 missing information
 inconsistencies (a major problem when large products or systems
are engineered)
 conflicting or unrealistic (unachievable) requirements.
Requirements management
53
Inception

Identify stakeholders




“who else do you think I should talk to?”
Recognize multiple points of view
Work toward collaboration
The first questions




Who is behind the request for this work?
Who will use the solution?
What will be the economic benefit of a successful
solution
Is there another source for the solution that you need?
54
Eliciting requirements






meetings are conducted and attended by both software engineers and
customers
rules for preparation and participation are established
an agenda is suggested
a "facilitator" (can be a customer, a developer, or an outsider) controls
the meeting
a "definition mechanism" (can be work sheets, flip charts, or wall
stickers or an electronic bulletin board, chat room or virtual forum) is
used
the goal is
 to identify the problem
 propose elements of the solution
 negotiate different approaches, and
 specify a preliminary set of solution requirements
55
Eliciting requirements
Conduct FA ST
m eet ings
Make list s of
f unct ions, classes
Make list s of
const raint s, et c.
f orm al priorit izat ion?
El i c i t re q u i re m e n t s
no
yes
Use QFD t o
priorit ize
requirem ent s
def ine act ors
inf orm ally
priorit ize
requirem ent s
draw use-case
diagram
writ e scenario
Creat e Use-cases
com plet e t em plat e
56
Quality Function Deployment




Function deployment determines the “value” (as
perceived by the customer) of each function
required of the system
Information deployment identifies data objects
and events
Task deployment examines the behavior of the
system
Value analysis determines the relative priority of
requirements
57
Elicitation work products







a statement of need and feasibility.
a bounded statement of scope for the system or product.
a list of customers, users, and other stakeholders who
participated in requirements elicitation
a description of the system’s technical environment.
a list of requirements (preferably organized by function)
and the domain constraints that apply to each.
a set of usage scenarios that provide insight into the use
of the system or product under different operating
conditions.
any prototypes developed to better define requirements.
58
Use-Cases



A collection of user scenarios that describe the thread of usage of a system
Each scenario is described from the point-of-view of an “actor”—a person
or device that interacts with the software in some way
Each scenario answers the following questions:
 Who is the primary actor, the secondary actor (s)?
 What are the actor’s goals?
 What preconditions should exist before the story begins?
 What main tasks or functions are performed by the actor?
 What extensions might be considered as the story is described?
 What variations in the actor’s interaction are possible?
 What system information will the actor acquire, produce, or change?
 Will the actor have to inform the system about changes in the external
environment?
 What information does the actor desire from the system?
 Does the actor wish to be informed about unexpected changes?
59
Use-Case diagram
Arms/ disarms
syst em
Accesses syst em
via Int ernet
sensors
homeow ner
Responds t o
alarm event
Encount ers an
error condit ion
syst em
administ rat or
Reconf igures sensors
and relat ed
syst em f eat ures
60
LIBSYS use cases
61
Building the analysis model

Elements of the analysis model

Scenario-based elements



Class-based elements


Implied by scenarios
Behavioral elements


Functional—processing narratives for software functions
Use-case—descriptions of the interaction between an “actor”
and the system
State diagram
Flow-oriented elements

Data flow diagram
62
Class diagram
From the SafeHome system …
Sensor
name/ id
ty pe
locat ion
area
characterist ics
ident if y()
enable()
disable()
reconf igure()
63
State diagram
Reading
commands
Init ializat ion
t urn copier
“on“
syst em st at us=“not ready”
display msg = “please wait ”
display st at us = blinking
subsyst ems
ready
ent ry/ swit ch machine on
do: run diagnost ics
do: init iat e all subsyst ems
not jammed
syst em st at us=“Ready”
display msg = “ent er cmd”
display st at us = st eady
paper f ull
ent ry/ subsyst ems ready
do: poll user input panel
do: read user input
do: int erpret user input
t urn copier “of f ”
st art copies
Making copies
copies complet e
syst em st at us=“Copying”
display msg= “copy count =”
display message=#copies
display st at us= st eady
ent ry/ st art copies
do: manage copying
do: monit or paper t ray
do: monit or paper f low
paper t ray empt y
paper jammed
problem diagnosis
syst em st at us=“Jammed”
display msg = “paper jam”
display message=locat ion
display st at us= blinking
load paper
syst em st at us=“load paper”
display msg= “load paper”
display st at us= blinking
ent ry/ paper empt y
do: lower paper t ray
do: monit or f ill swit ch
do: raise paper t ray
not jammed
ent ry/ paper jammed
do: det ermine locat ion
do: provide correct ivemsg.
do: int errupt making copies
Figure 7.6 Preliminary UML st at e diagram for a phot ocopier
64
Analysis patterns
Pattern name: A descriptor that captures the essence of the pattern.
Intent: Describes what the pattern accomplishes or represents
Motivation: A scenario illustrates how pattern can be used to address problem.
Forces and context: A description of external issues (forces) that affect how the
pattern is used and external issues that will be resolved when pattern is applied.
Solution: A description of how the pattern is applied to solve the problem with an
emphasis on structural and behavioral issues.
Consequences: Addresses what happens when the pattern is applied and what
trade-offs exist during its application.
Design: Discusses how the analysis pattern can be achieved through the use of
known design patterns.
Known uses: Examples of uses within actual systems.
Related patterns: On e or more analysis patterns that are related to the named
pattern because (1) it is commonly used with the named pattern; (2) it is
structurally similar to the named pattern; (3) it is a variation of the named pattern.
65
Negotiating requirements

Identify the key stakeholders


Determine each of the stakeholders “win
conditions”


These are the people who will be involved in the
negotiation
Win conditions are not always obvious
Negotiate

Work toward a set of requirements that lead to “winwin”
66
Validating requirements-I






Is each requirement consistent with the overall objective for
the system/product?
Have all requirements been specified at the proper level of
abstraction? That is, do some requirements provide a level
of technical detail that is inappropriate at this stage?
Is the requirement really necessary or does it represent an
add-on feature that may not be essential to the objective of
the system?
Is each requirement bounded and unambiguous?
Does each requirement have attribution? That is, is a
source (generally, a specific individual) noted for each
requirement?
Do any requirements conflict with other requirements?
67
Validating requirements-II





Is each requirement achievable in the technical environment
that will house the system or product?
Is each requirement testable, once implemented?
Does the requirements model properly reflect the information,
function and behavior of the system to be built.
Has the requirements model been “partitioned” in a way that
exposes progressively more detailed information about the
system.
Have requirements patterns been used to simplify the
requirements model. Have all patterns been properly validated?
Are all patterns consistent with customer requirements?
68