Lezione 4 Requirements u u u S 2001

  • Slides: 43
Download presentation
Lezione 4. Requirements • • u u u [S 2001, Cap. 5] [AC 96,

Lezione 4. Requirements • • u u u [S 2001, Cap. 5] [AC 96, Cap. 1] Functional, non-functional, domain requirements User requirements System and software requirements Requirements languages The requirements document Requirements analysis [AC 96] Slide 1

What is a requirement? u It may range from a high-level abstract statement of

What is a requirement? u It may range from a high-level abstract statement of a service or of a system constraint to a detailed mathematical functional specification… u …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) Slide 2

Requirements definition/specification u Requirements definition (user requirements) • u Requirements specification (system requirements) •

Requirements definition/specification u Requirements definition (user requirements) • u Requirements specification (system requirements) • u 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) 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……. . . Slide 3

Requirements definition/spec. - example Slide 4

Requirements definition/spec. - example Slide 4

Requirements readers Slide 5

Requirements readers Slide 5

Functional, non-functional, domain requirements u u u Requirements engineering is the process of establishing

Functional, non-functional, domain requirements u u u 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 Slide 6

Functional requirements - examples u ‘The user shall be able to search either all

Functional requirements - examples u ‘The user shall be able to search either all of the initial set of databases or select a subset from it’. u ‘The system shall provide appropriate viewers (*) for the user to read documents in the document store’. • • u (*) 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’. Slide 7

Non-functional requirements u u u On: Reliability, response time, storage capacity, I/O device capability,

Non-functional requirements u u u 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 Slide 8

Non-functional requirement types Slide 9

Non-functional requirement types Slide 9

Non-functional requirements examples u Product requirement • u Organisational requirement • u 4. C.

Non-functional requirements examples u Product requirement • u Organisational requirement • u 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 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 Slide 10

Verifiable non-functional reqs. Vs. goals u A system ‘goal’ • u A verifiable non-functional

Verifiable non-functional reqs. Vs. goals u A system ‘goal’ • u A verifiable non-functional requirement • u The system should be easy to use by experienced controllers and should be organised in such a way that user errors are minimised. 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 Slide 11

Requirements measures Slide 12

Requirements measures Slide 12

Non functional requirements conflicts u . . . are common in complex systems u

Non functional requirements conflicts u . . . are common in complex systems u Example: Spacecraft system • • • Req. 1 - System should fit into 4 Mbytes 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 4 Mbytes: drop one of the requirements. . . Slide 13

Domain requirements u u u Derived from the application domain; describe system features that

Domain requirements u u u 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 Slide 14

Example: Library system domain requirements u ‘There shall be a standard user interface to

Example: Library system domain requirements u ‘There shall be a standard user interface to all databases which shall be based on the Z 39. 50 standard’ (a standard for this Library). u ‘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’. Slide 15

Example: train system domain requirement u The deceleration of the train shall be computed

Example: train system domain requirement u The deceleration of the train shall be computed as: • Dtrain = Dcontrol + Dgradient where Dgradient is 9. 81 ms 2 * compensated gradient/alpha and where the values of 9. 81 ms 2 /alpha are known for different types of train. Slide 16

User requirements u u Should describe functional and non-functional requirements so that they are

User requirements u u Should describe functional and non-functional requirements so that they are understandable by nontechnical 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 Slide 17

Example: Editor grid requirement u 2. 6 Grid facilities ‘To assist in the positioning

Example: Editor grid requirement u 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’. Slide 18

Problems in the Editor grid requirement u Grid requirement mixes three different kinds of

Problems in the Editor grid requirement u 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) Slide 19

Editor example: structured presentation Slide 20

Editor example: structured presentation Slide 20

Editor example: detailed user requirement Slide 21

Editor example: detailed user requirement Slide 21

System and software requirements u u More detailed specifications of user requirements Serve as

System and software requirements u u More detailed specifications of user requirements Serve as a basis for the Design • • u u 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…) Slide 22

Alternatives to NL specification Slide 23

Alternatives to NL specification Slide 23

Structured natural language specifications u u u A limited form of natural language may

Structured natural language specifications u u u 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 Slide 24

Form-based req. spec. - Editor example Slide 25

Form-based req. spec. - Editor example Slide 25

PDL (Program Descr. Language)-based requirements definition u Requirements may be defined operationally using a

PDL (Program Descr. Language)-based requirements definition u Requirements may be defined operationally using a programming language (e. g. Java) • u Most appropriate in two situations • • u enriched by constructs for further flexibility 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 Slide 26

PDL Example: Part of an ATM specification Slide 27

PDL Example: Part of an ATM specification Slide 27

System requirements: interface specification u u Most systems must operate with other systems and

System requirements: interface specification u u 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 • • • u Procedural interfaces Data structures that are exchanged Data representations Formal notations are an effective technique for interface specification Slide 28

PDL interface description Il costrutto ‘Interface’ di Java è molto adatto alla specifica… di

PDL interface description Il costrutto ‘Interface’ di Java è molto adatto alla specifica… di interfacce Slide 29

Requirements document structure u Introduction • u Glossary • u Describe the services to

Requirements document structure u Introduction • u Glossary • u Describe the services to be provided Non-functional requirements definition (user reqs. ) • u Define technical terms used Functional requirements definition (user reqs. ) • u Describe need for the system and how it fits with business objectives Define constraints on the system and the development process System Architecture • helps structuring requirements around subsystems Slide 30

u System and software requirements specification • u System models • u Define fundamental

u System and software requirements specification • u System models • u Define fundamental assumptions on which the system is based anticipated changes Appendices • • • u Define models showing system components and relationships System evolution • u Detailed specification of functional requirements System hardware platform description Database requirements (as an ER model perhaps) May include USER MANUAL and TEST PLAN Index Slide 31

Analisi dei requisiti [AC 96, fig 1. 1] Slide 32

Analisi dei requisiti [AC 96, fig 1. 1] Slide 32

La fase di Analisi • • u Sottofase I (linguaggio naturale +. . .

La fase di Analisi • • u Sottofase I (linguaggio naturale +. . . ) • • u Studia e definisce il problema da risolvere Stretta interazione con il committente 1. studio di fattibilità 2. comprensione del dominio (==> glossario) 3. stesura (raccolta e definizione) dei requisiti 4. ispezione dei requisiti …’analisi’ Sottofase II (linguaggio formale) • 5. specifica formale dei requisiti ==> modello astratto del sistema Slide 33

1. Studio di fattibilità u Valutazione di costi, benefici e rischi • • •

1. Studio di fattibilità u Valutazione di costi, benefici e rischi • • • u Output • u Disponibilità di librerie SW? HW adatto alle prestazioni attese? Uso di tecnologie non consolidate? Valore di mercato al tempo di consegna? n scenari di sviluppo, con relativi tempi e costi Società specializzate nel puro studio di fattibilità Slide 34

2. Comprensione del dominio • Comprensione dei concetti e termini usati dal Committente per

2. Comprensione del dominio • Comprensione dei concetti e termini usati dal Committente per parlare del sistema e del suo contesto. » • Input: documenti dal Committente e altri reperiti autonomam. » • Lo Sviluppatore acquisisce la competenza del Committente, non viceversa ==> migliore interazione 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, . . . Slide 35

Stesura del Glossario Slide 36

Stesura del Glossario Slide 36

3. Stesura dei requisiti • Ha valore contrattuale… (stesura e ispezione) Slide 37

3. Stesura dei requisiti • Ha valore contrattuale… (stesura e ispezione) Slide 37

Il documento dei requisiti • • • Ha valore contrattuale…. . ma è soggetto

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 Slide 38

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

• 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 Slide 39

4. Ispezione dei requisiti u Boehm: • u “Trovare e riparare un difetto nel

4. Ispezione dei requisiti u Boehm: • u “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”. Slide 40

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

Lettura strutturata u u È 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 • u Ogni gruppo trova mediamente ‘solo’ 25 difetti. L’ispezione parallela e ridondante paga. Slide 41

5. Specifica formale u Descrizione tecnica del comportamento di un sistema che risponde ai

5. Specifica formale u Descrizione tecnica del comportamento di un sistema che risponde ai requisiti • u (dei requisiti…) [AC 96] enfasi sull’osservatore esterno: sistema come black box ==> Modello astratto del sistema • primo passo dalla caratterizzazione verso la soluzione del problema Slide 42

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

Specifica simultanea dei requisiti (problema) e di un modello astratto del sistema (soluzione) User Requirements Formal specification P 1 R 1. . . P 2 Modello formale astratto del sistema, dal comportamento osservabile desiderato R 2. . . R 3. . . In linguaggio naturale P 3 ? ? ? In linguaggio formale eseguibile, analizzabile Slide 43