43
Slide 1 [S2001, Cap. 5] [AC96, Cap. 1] Functional, non-functional, domain requirements User requirements System and software requirements Requirements languages The requirements document Requirements analysis [AC96] Lezione 4. Requirements

Slide 1 [S2001, Cap. 5] [AC96, Cap. 1] u Functional, non-functional, domain requirements u User requirements u System and software requirements u Requirements

Embed Size (px)

Citation preview

Page 1: Slide 1 [S2001, Cap. 5] [AC96, Cap. 1] u Functional, non-functional, domain requirements u User requirements u System and software requirements u Requirements

Slide 1

• [S2001, Cap. 5]

• [AC96, Cap. 1]

Functional, non-functional, domain requirements User requirements System and software requirements Requirements languages The requirements document Requirements analysis [AC96]

Lezione 4. Requirements

Page 2: Slide 1 [S2001, Cap. 5] [AC96, Cap. 1] u Functional, non-functional, domain requirements u User requirements u System and software requirements u Requirements

Slide 2

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…

…since requirements may serve a dual function• May be the basis for a bid for a contract - therefore must be

open to interpretation (client ==> potential developers)

• May be the basis for the contract itself - therefore must be defined in detail (developer ==> potential client)

Page 3: Slide 1 [S2001, Cap. 5] [AC96, Cap. 1] u Functional, non-functional, domain requirements u User requirements u System and software requirements u Requirements

Slide 3

Requirements definition/specification

Requirements definition (user requirements)• A statement in natural language plus diagrams of the services the

system provides and its operational constraints. Based on information from Client, and written for him (or even by him)

Requirements specification (system requirements)• A structured document setting out detailed descriptions of the system

services. Written as a contract between Client and Developer

Software specification (software requirements)• A detailed software description which can serve as a basis for a

design or implementation. Written for technical developers (design team, programmers…). May be omitted……...

Page 4: Slide 1 [S2001, Cap. 5] [AC96, Cap. 1] u Functional, non-functional, domain requirements u User requirements u System and software requirements u Requirements

Slide 4

Requirements definition/spec. - example

1. The software must provide a means of representing and1. accessing external files created by other tools.

1.1 The user should be provided with facilities to define the type of1.2 external files.1.2 Each external file type may have an associated tool which may be1.2 applied to the file.1.3 Each external file type may be represented as a specific icon on1.2 the user’s display.1.4 Facilities should be provided for the icon representing an1.2 external file type to be defined by the user.1.5 When a user selects an icon representing an external file, the1.2 effect of that selection is to apply the tool associated with the type of1.2 the external file to the file represented by the selected icon.

Requirements definition

Requirements specification

Page 5: Slide 1 [S2001, Cap. 5] [AC96, Cap. 1] u Functional, non-functional, domain requirements u User requirements u System and software requirements u Requirements

Slide 5

Requirements readersClient managersSystem end-usersClient engineersContractor managersSystem architects

System end-usersClient engineersSystem architectsSoftware developers

Client engineers (perhaps)System architectsSoftware developers

Requirementsdefinition

Requirementsspecification

Softwarespecification

Page 6: Slide 1 [S2001, Cap. 5] [AC96, Cap. 1] u Functional, non-functional, domain requirements u User requirements u System and software requirements u Requirements

Slide 6

Functional, non-functional, domain requirements

Requirements engineering is the process of establishing the services that the Client requires from a system and the constraints under which it operates and is developed

Requirements may be functional or non-functional

• Functional requirements describe system services or functions, often expressed in terms system reactions to inputs from the environment

• Non-functional requirements are constraints on the services offered by the system, and on the development process

Domain requirements (funct./non funct.)come from the application domain of the system and reflect characteristics of that domain

Page 7: Slide 1 [S2001, Cap. 5] [AC96, Cap. 1] u Functional, non-functional, domain requirements u User requirements u System and software requirements u Requirements

Slide 7

Functional requirements - examples

‘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’.

• (*) User intention - special purpose viewer for each document type

• (*) Developer interpretation - Provide a text viewer that shows the contents of the document

‘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’.

Page 8: Slide 1 [S2001, Cap. 5] [AC96, Cap. 1] u Functional, non-functional, domain requirements u User requirements u System and software requirements u Requirements

Slide 8

Non-functional requirements

On: Reliability, response time, storage capacity, I/O device capability, data representation.

On: 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

Page 9: Slide 1 [S2001, Cap. 5] [AC96, Cap. 1] u Functional, non-functional, domain requirements u User requirements u System and software requirements u Requirements

Slide 9

Non-functional requirement types

Performancerequirements

Spacerequirements

Usabilityrequirements

Efficiencyrequirements

Reliabilityrequirements

Portabilityrequirements

Interoperabilityrequirements

Ethicalrequirements

Legislativerequirements

Implementationrequirements

Standardsrequirements

Deliveryrequirements

Safetyrequirements

Privacyrequirements

Productrequirements

Organizationalrequirements

Externalrequirements

Non-functionalrequirements

Page 10: Slide 1 [S2001, Cap. 5] [AC96, Cap. 1] u Functional, non-functional, domain requirements u User requirements u System and software requirements u Requirements

Slide 10

Non-functional requirements examples

Product requirement• 4.C.8 It shall be possible for all necessary

communication between the APSE and the user to be expressed in the standard Ada character set

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

Page 11: Slide 1 [S2001, Cap. 5] [AC96, Cap. 1] u Functional, non-functional, domain requirements u User requirements u System and software requirements u Requirements

Slide 11

Verifiable non-functional reqs. Vs. goals

A system ‘goal’• The system should be easy to use by experienced controllers and

should be organised in such a way that user errors are minimised.

A verifiable non-functional requirement• Experienced controllers shall be able to use all the system functions

after a total of two hours training. After this training, the average number of errors made by experienced users shall not exceed two per day.

… nevertheless, goals are helpful to developers as they convey the intentions of the Client

Page 12: Slide 1 [S2001, Cap. 5] [AC96, Cap. 1] u Functional, non-functional, domain requirements u User requirements u System and software requirements u Requirements

Slide 12

Requirements measures

Property MeasureSpeed Processed transactions/second

User/Event response timeScreen refresh time

Size K BytesNumber of RAM chips

Ease of use Training timeNumber of help frames

Reliability Mean time to failureProbability of unavailabilityRate of failure occurrenceAvailability

Robustness Time to restart after failurePercentage of events causing failureProbability of data corruption on failure

Portability Percentage of target dependent statementsNumber of target systems

Page 13: Slide 1 [S2001, Cap. 5] [AC96, Cap. 1] u Functional, non-functional, domain requirements u User requirements u System and software requirements u Requirements

Slide 13

Non functional requirements conflicts

... are common in complex systems

Example: Spacecraft system• Req.1 - System should fit into 4Mbytes of

memory• Req.2 - System should be written in ADA

• However, it may be impossible to compile an ADA program with the required functionality into 4Mbytes: drop one of the requirements...

Page 14: Slide 1 [S2001, Cap. 5] [AC96, Cap. 1] u Functional, non-functional, domain requirements u User requirements u System and software requirements u Requirements

Slide 14

Domain requirements

Derived from the application domain; describe system features that reflect the domain

May be new functional requirements, constraints on existing requirements or define specific computations

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

Page 15: Slide 1 [S2001, Cap. 5] [AC96, Cap. 1] u Functional, non-functional, domain requirements u User requirements u System and software requirements u Requirements

Slide 15

Example: Library system domain requirements

‘There shall be a standard user interface to all databases which shall be based on the Z39.50 standard’ (a standard for this Library).

‘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’.

Page 16: Slide 1 [S2001, Cap. 5] [AC96, Cap. 1] u Functional, non-functional, domain requirements u User requirements u System and software requirements u Requirements

Slide 16

Example: train system domain requirement

The deceleration of the train shall be computed as:

• 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.

Page 17: Slide 1 [S2001, Cap. 5] [AC96, Cap. 1] u Functional, non-functional, domain requirements u User requirements u System and software requirements u Requirements

Slide 17

User requirements Should describe functional and non-functional

requirements so that they are understandable by non-technical system-users. Externally visible behaviour

User requirements are defined using natural language, tables and diagrams. Problems:• Lack of clarity, ambiguity (‘Dogs must be carried’)

» Precision is difficult without making the document difficult to read

• Requirements confusion» Functional and non-functional requirements tend to be mixed-up

• Requirements amalgamation» Several different requirements may be expressed together

Page 18: Slide 1 [S2001, Cap. 5] [AC96, Cap. 1] u Functional, non-functional, domain requirements u User requirements u System and software requirements u Requirements

Slide 18

Example: 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’.

Page 19: Slide 1 [S2001, Cap. 5] [AC96, Cap. 1] u Functional, non-functional, domain requirements u User requirements u System and software requirements u Requirements

Slide 19

Problems in the Editor grid requirement

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)

Page 20: Slide 1 [S2001, Cap. 5] [AC96, Cap. 1] u Functional, non-functional, domain requirements u User requirements u System and software requirements u Requirements

Slide 20

Editor example: structured presentation

2.6 Grid facilities2.6.1 The editor shall provide a grid facility where a

matrix of horizontal and vertical lines provide abackground to the editor window. T his grid shall bea p assive grid where the alignment of entities is theuser's responsibility.Rationale: A grid helps the user to create a tidydiagram with well-spaced entities. Although an activegrid, where entities 'snap-to' grid lines can be useful,the positioning is imprecise. The user is the best personto decide where entities should be positioned.

Specification: ECLIPSE/WS/Tools/DE/FS Section 5.6

Page 21: Slide 1 [S2001, Cap. 5] [AC96, Cap. 1] u Functional, non-functional, domain requirements u User requirements u System and software requirements u Requirements

Slide 21

Editor example: detailed user requirement

3.5.1 Adding nodes to a design3.5.1.1 The editor shall provide a f acility for users to add nodes of a specified type to their

design.

3.5.1.2 The sequence of actions to add a node should be as follows:

1. The user should select the type of node to be added.

2. The user should move the cursor to the approximate node position in the diagram andindicate that the node symbol should be added at that point.

3. The user should then drag the node symbol to its final position.

Rationale: The user is the best person to decide where to position a node on the diagram.This approach gives the user direct control over node type selection and positioning.

Specification: ECLIPSE/WS/Tools/DE/FS. Section 3.5.1

Page 22: Slide 1 [S2001, Cap. 5] [AC96, Cap. 1] u Functional, non-functional, domain requirements u User requirements u System and software requirements u Requirements

Slide 22

System and software requirements

More detailed specifications of user requirements Serve as a basis for the Design

• in principle Reqs. and Design are separated (WHAT vs. HOW)

• in practice they are interdependent

May be used as part of the system contract May be complemented with, or expressed by system

models (Entity-Relation, Data-Flow, Petri nets, Communicating Finite State Machines, Statecharts, Basic LOTOS…)

Page 23: Slide 1 [S2001, Cap. 5] [AC96, Cap. 1] u Functional, non-functional, domain requirements u User requirements u System and software requirements u Requirements

Slide 23

Alternatives to NL specificationNotation DescriptionStructurednaturallanguage

This approach depends on defining standard forms ortemplates to express the requirements specification.

Designdescriptionlanguages

This approach uses a language like a programming languagebut with more abstract features to specify the requirementsby defining an operational model of the system.

Graphicalnotations

A graphical language, supplemented by text annotations isused to define the functional requirements for the system.An early example of such a graphical language was SADT(Ross, 1977; Schoman and Ross, 1977). More recently, use-case descriptions (Jacobsen, Christerson et al., 1993) havebeen used. I discuss these in the following chapter.

Mathematicalspecifications

These are notations based on mathematical concepts suchas finite-state machines or sets. These unambiguousspecifications reduce the arguments between customer andcontractor about system functionality. However, mostcustomers don’t understand formal specifications and arereluctant to accept it as a system contract. I discuss formalspecification in Chapter 9.

Page 24: Slide 1 [S2001, Cap. 5] [AC96, Cap. 1] u Functional, non-functional, domain requirements u User requirements u System and software requirements u Requirements

Slide 24

Structured natural language specifications

A limited form of natural language may be used to express requirements

This removes some of the problems resulting from ambiguity and over-flexibility and imposes a degree of uniformity on a specification

Often supported by a forms-based approach

Page 25: Slide 1 [S2001, Cap. 5] [AC96, Cap. 1] u Functional, non-functional, domain requirements u User requirements u System and software requirements u Requirements

Slide 25

Form-based req. spec. - Editor example

ECLIPSE/Workstation/Tools/DE/FS/3.5.1

Function Add node

Description Adds a node to an existing design. The user selects the type of node, and its position.When added to the design, the node becomes the current selection. The user chooses the node position bymoving the cursor to the area where the node is added.

Inputs Node type, Node position, Design identifier.

Source Node type and Node position are input by the user, Design identifier from the database.

Outputs Design identifier.

Destination The design database. The design is committed to the database on completion of theoperation.

Requires Design graph rooted at input design identifier.

Pre-condition The design is open and displayed on the user's screen.

Post-condition The design is unchanged apart from the addition of a node of the specified typeat the given position.

Side-effects None

Definition: ECLIPSE/Workstation/Tools/DE/RD/3.5.1

Page 26: Slide 1 [S2001, Cap. 5] [AC96, Cap. 1] u Functional, non-functional, domain requirements u User requirements u System and software requirements u Requirements

Slide 26

PDL (Program Descr. Language)-based requirements definition

Requirements may be defined operationally using a programming language (e.g. Java)• enriched by constructs for further flexibility

Most appropriate in two situations• Where an operation is specified as a sequence of actions and the

order is important

• When hardware and software interfaces have to be specified

Disadvantages are• The PDL may not be sufficiently expressive to define domain

concepts

• The specification will be taken as a design rather than a specification

Page 27: Slide 1 [S2001, Cap. 5] [AC96, Cap. 1] u Functional, non-functional, domain requirements u User requirements u System and software requirements u Requirements

Slide 27

PDL Example: Part of an ATM specification

class ATM {// declarations herepublic static void main (String args[]) throws InvalidCard {

try {thisCard.read () ; // may throw InvalidCard exceptionpin = KeyPad.readPin () ; attempts = 1 ;while ( !thisCard.pin.equals (pin) & attempts < 4 )

{ pin = KeyPad.readPin () ; attempts = attempts + 1 ;}if (!thisCard.pin.equals (pin))

throw new InvalidCard ("Bad PIN");thisBalance = thisCard.getBalance () ;do { Screen.prompt (" Please select a service ") ;

service = Screen.touchKey () ;switch (service) {

case Services.withdrawalWithReceipt:receiptRequired = true ;

Page 28: Slide 1 [S2001, Cap. 5] [AC96, Cap. 1] u Functional, non-functional, domain requirements u User requirements u System and software requirements u Requirements

Slide 28

System requirements: 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

Page 29: Slide 1 [S2001, Cap. 5] [AC96, Cap. 1] u Functional, non-functional, domain requirements u User requirements u System and software requirements u Requirements

Slide 29

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

Il costrutto ‘Interface’ di Java è molto adatto alla specifica… di interfacce

Page 30: Slide 1 [S2001, Cap. 5] [AC96, Cap. 1] u Functional, non-functional, domain requirements u User requirements u System and software requirements u Requirements

Slide 30

Requirements document structure

Introduction• Describe need for the system and how it fits with business objectives

Glossary• Define technical terms used

Functional requirements definition (user reqs.)• Describe the services to be provided

Non-functional requirements definition (user reqs.)• Define constraints on the system and the development process

System Architecture• helps structuring requirements around subsystems

Page 31: Slide 1 [S2001, Cap. 5] [AC96, Cap. 1] u Functional, non-functional, domain requirements u User requirements u System and software requirements u Requirements

Slide 31

System and software requirements specification• Detailed specification of functional requirements

System models• Define models showing system components and relationships

System evolution• Define fundamental assumptions on which the system is based and

anticipated changes

Appendices• System hardware platform description

• Database requirements (as an ER model perhaps)

• May include USER MANUAL and TEST PLAN

Index

Page 32: Slide 1 [S2001, Cap. 5] [AC96, Cap. 1] u Functional, non-functional, domain requirements u User requirements u System and software requirements u Requirements

Slide 32

Analisi dei requisiti [AC96, fig 1.1]

Page 33: Slide 1 [S2001, Cap. 5] [AC96, Cap. 1] u Functional, non-functional, domain requirements u User requirements u System and software requirements u Requirements

Slide 33

La fase di Analisi

• Studia e definisce il problema da risolvere

• Stretta interazione con il committente

Sottofase I (linguaggio naturale +...)• 1. studio di fattibilità

• 2. comprensione del dominio (==> glossario)

• 3. stesura (raccolta e definizione) dei requisiti

• 4. ispezione dei requisiti

Sottofase II (linguaggio formale)• 5. specifica formale dei requisiti ==> modello astratto del

sistema

…’analisi’

Page 34: Slide 1 [S2001, Cap. 5] [AC96, Cap. 1] u Functional, non-functional, domain requirements u User requirements u System and software requirements u Requirements

Slide 34

1. Studio di fattibilità

Valutazione di costi, benefici e rischi• Disponibilità di librerie SW? HW adatto alle prestazioni attese?

• Uso di tecnologie non consolidate?

• Valore di mercato al tempo di consegna?

Output• n scenari di sviluppo, con relativi tempi e costi

Società specializzate nel puro studio di fattibilità

Page 35: Slide 1 [S2001, Cap. 5] [AC96, Cap. 1] u Functional, non-functional, domain requirements u User requirements u System and software requirements u Requirements

Slide 35

2. Comprensione del dominio

• Comprensione dei concetti e termini usati dal Committente per parlare del sistema e del suo contesto.

» Lo Sviluppatore acquisisce la competenza del Committente, non viceversa ==> migliore interazione

• Input: documenti dal Committente e altri reperiti autonomam.» Es. strutture organizzative/commerciali, caratteristiche di impianti,

leggi fisiche

• Output: Glossario» Insieme chiuso e sintetico di definizioni che rifletta la complessità

del dominio.

» Può includere descrizioni di algoritmi, procedure d’ufficio, ...

Page 36: Slide 1 [S2001, Cap. 5] [AC96, Cap. 1] u Functional, non-functional, domain requirements u User requirements u System and software requirements u Requirements

Slide 36

Stesura del Glossario

Page 37: Slide 1 [S2001, Cap. 5] [AC96, Cap. 1] u Functional, non-functional, domain requirements u User requirements u System and software requirements u Requirements

Slide 37

3. Stesura dei requisiti • Ha valore contrattuale…

(stesura e ispezione)

Page 38: Slide 1 [S2001, Cap. 5] [AC96, Cap. 1] u Functional, non-functional, domain requirements u User requirements u System and software requirements u Requirements

Slide 38

Il documento dei requisiti

• Ha valore contrattuale…

• .. ma è soggetto a cambiamenti ‘tardivi’.

• E’ scritto in linguaggio naturale

• Ogni requisito cattura un aspetto o vincolo, completo e indipendente, del sistema

• Requisiti obbligatori, desiderabili, opzionali (==> contratto)

• Non dovrebbe contenere:» inconsistenze (req. ==><== req.)

» ambiguità (req. ?!)

» imprecisioni terminologiche (req. ==><== glossario)

» ridondanze (req ==> req.)

» dettagli tecnici e rif. alla soluzione-implementazione

Page 39: Slide 1 [S2001, Cap. 5] [AC96, Cap. 1] u Functional, non-functional, domain requirements u User requirements u System and software requirements u Requirements

Slide 39

• Dovrebbe essere completo» Elenca tutte e sole le esigenze del Committente

» Usa tutti e soli i termini del Glossario

• Dovrebbe essere ben strutturato» bilanciando la granularità dei requisiti

» minimizzando riferimenti in avanti.

• Lemmario: elenco dei termini usati nei requisiti, ciascuno con lista di puntatori ai requisiti che lo usano.

» Facilita la ricerca di inconsistenze o ridondanze in requisiti semanticamente vicini

Page 40: Slide 1 [S2001, Cap. 5] [AC96, Cap. 1] u Functional, non-functional, domain requirements u User requirements u System and software requirements u Requirements

Slide 40

4. Ispezione dei requisiti

Boehm:• “Trovare e riparare un difetto nel software consegnato costa

100 volte meno che farlo durante l’analisi dei requisiti”.

Fagan:• “la maggior parte degli errori si manifesta dopo la consegna

del sistema, ma ha origine durante l’analisi dei requisiti”.

Page 41: Slide 1 [S2001, Cap. 5] [AC96, Cap. 1] u Functional, non-functional, domain requirements u User requirements u System and software requirements u Requirements

Slide 41

Lettura strutturata

È economica e rivela il 60% degli errori [Boehm] ESEMPIO

• Analisi dei requisiti di CTC (Centralised Traffic Controller) delle ferrovie nordamericane - 1990

• 10 gruppi di analisti in parallelo

• Dei 92 difetti del documento dei requisiti» 77 vengono trovati durante l’ispezione dei requisiti

» 15 nelle fasi successive

• Ogni gruppo trova mediamente ‘solo’ 25 difetti.

L’ispezione parallela e ridondante paga.

Page 42: Slide 1 [S2001, Cap. 5] [AC96, Cap. 1] u Functional, non-functional, domain requirements u User requirements u System and software requirements u Requirements

Slide 42

5. Specifica formale (dei requisiti…) [AC96]

Descrizione tecnica del comportamento di un sistema che risponde ai requisiti • enfasi sull’osservatore esterno: sistema come black box

==> Modello astratto del sistema• primo passo dalla caratterizzazione verso la soluzione del

problema

Page 43: Slide 1 [S2001, Cap. 5] [AC96, Cap. 1] u Functional, non-functional, domain requirements u User requirements u System and software requirements u Requirements

Slide 43

Specifica simultanea dei requisiti (problema) e di un modello astratto del sistema (soluzione)

User Requirements

In linguaggio naturale In linguaggio formaleeseguibile, analizzabile

R1 ...

R3 ...

R2 ...

Formal specification

Modello formale astratto del sistema,dal comportamento osservabile desiderato

P1P2

P3

???