lecture 10: requirements engineering wrap-up · 2016-06-13 · –10 – 2016-06-13 – main–...

46
– 10 – 2016-06-13 – main – Softwaretechnik / Software-Engineering Lecture 10: Requirements Engineering Wrap-Up 2016-06-13 Prof. Dr. Andreas Podelski, Dr. Bernd Westphal Albert-Ludwigs-Universität Freiburg, Germany

Upload: others

Post on 26-Jan-2020

9 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Lecture 10: Requirements Engineering Wrap-Up · 2016-06-13 · –10 – 2016-06-13 – main– Softwaretechnik / Software-Engineering Lecture 10: Requirements Engineering Wrap-Up

–10

–2

016

-06

-13

–m

ain

Softwaretechnik / Software-Engineering

Lecture 10: Requirements Engineering

Wrap-Up

2016-06-13

Prof. Dr. Andreas Podelski, Dr. Bernd Westphal

Albert-Ludwigs-Universität Freiburg, Germany

Page 2: Lecture 10: Requirements Engineering Wrap-Up · 2016-06-13 · –10 – 2016-06-13 – main– Softwaretechnik / Software-Engineering Lecture 10: Requirements Engineering Wrap-Up

Topic Area Requirements Engineering: Content–

10–

20

16-0

6-1

3–

Sb

lock

con

ten

t–

2/34

• Introduction

• Requirements Specification

• Desired Properties

• Kinds of Requirements

• Analysis Techniques

• Documents

• Dictionary, Specification

• Specification Languages

• Natural Language

• Decision Tables

• Syntax, Semantics

• Completeness, Consistency, . . .

• Scenarios

• User Stories, Use Cases

• Live Sequence Charts

• Syntax, Semantics

• Definition: Software & SW Specification

• Wrap-Up

VL 6

.

..

VL 7

.

..

VL 8...

VL 9...

VL 10...

Page 3: Lecture 10: Requirements Engineering Wrap-Up · 2016-06-13 · –10 – 2016-06-13 – main– Softwaretechnik / Software-Engineering Lecture 10: Requirements Engineering Wrap-Up

Content–

10–

20

16-0

6-1

3–

Sco

nte

nt

3/34

• Pre-Charts

• Semantics, once again

• Requirements Engineering with scenarios

• Strengthening scenarions into requirements

• Software, formally

• Software specification

• Requirements Engineering, formally

• Software implements specification

• LSCs vs. Software

• Software implements LSCs

• Scenarios and tests

• Play In/Play Out

• Requirements Engineering Wrap-Up

Page 4: Lecture 10: Requirements Engineering Wrap-Up · 2016-06-13 · –10 – 2016-06-13 – main– Softwaretechnik / Software-Engineering Lecture 10: Requirements Engineering Wrap-Up

Pre-Charts (Again)

–10

–2

016

-06

-13

–m

ain

4/34

Page 5: Lecture 10: Requirements Engineering Wrap-Up · 2016-06-13 · –10 – 2016-06-13 – main– Softwaretechnik / Software-Engineering Lecture 10: Requirements Engineering Wrap-Up

Example: Vending Machine–

10–

20

16-0

6-1

3–

Sre

callp

c–

5/34

• Positive scenario: Buy a Softdrink

(i) Insert one 1 euro coin.

(ii) Press the ‘softdrink’ button.

(iii) Get a softdrink.

• Positive scenario: Get Change

(i) Insert one 50 cent and one 1 euro coin.

(ii) Press the ‘softdrink’ button.

(iii) Get a softdrink.

(iv) Get 50 cent change.

• Negative scenario: A Drink for Free

(i) Insert one 1 euro coin.

(ii) Press the ‘softdrink’ button.

(iii) Do not insert any more money.

(iv) Get two softdrinks.

LSC: buy softdrinkAC: trueAM: invariant I: permissive

User Vend. Ma.

E1

pSOFT

SOFT

LSC: get changeAC: trueAM: invariant I: permissive

User Vend. Ma.

C50

E1

pSOFT

SOFT

chg-C50

LSC: only one drinkAC: trueAM: invariant I: permissive

User Vend. Ma.

E1

pSOFT

SOFT

SOFT

¬C50 ! ∧ ¬E1 !

false

westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
Page 6: Lecture 10: Requirements Engineering Wrap-Up · 2016-06-13 · –10 – 2016-06-13 – main– Softwaretechnik / Software-Engineering Lecture 10: Requirements Engineering Wrap-Up

Pre-Charts–

10–

20

16-0

6-1

3–

Sre

callp

c–

6/34

A full LSC L = (PC ,MC , ac, am,ΘL ) actually consists of

• pre-chart PC = ((LP ,�P ,∼P ), IP ,MsgP,CondP , LocInvP ,ΘP ) (poss. empty),

• main-chart MC = ((LM ,�M ,∼M ), IM ,MsgM,CondM , LocInvM ,ΘM ),

• activation condition ac ∈ Φ(C), and mode am ∈ {initial, invariant},

• strictness flag strict , chart mode existential (ΘL = cold) or universal (ΘL = hot).

Concrete syntax:

LSC: only one drinkAC: trueAM: invariant I: permissive

User Vend. Ma.

E1

pSOFT

SOFT

SOFT

¬C50 ! ∧ ¬E1 !

false

westphal
Bleistift
Page 7: Lecture 10: Requirements Engineering Wrap-Up · 2016-06-13 · –10 – 2016-06-13 – main– Softwaretechnik / Software-Engineering Lecture 10: Requirements Engineering Wrap-Up

Pre-Charts–

10–

20

16-0

6-1

3–

Sre

callp

c–

6/34

A full LSC L = (PC ,MC , ac, am,ΘL ) actually consists of

• pre-chart PC = ((LP ,�P ,∼P ), IP ,MsgP,CondP , LocInvP ,ΘP ) (poss. empty),

• main-chart MC = ((LM ,�M ,∼M ), IM ,MsgM,CondM , LocInvM ,ΘM ),

• activation condition ac ∈ Φ(C), and mode am ∈ {initial, invariant},

• strictness flag strict , chart mode existential (ΘL = cold) or universal (ΘL = hot).

A set of wordsW ⊆ (C → B)ω is accepted by L , denoted byW |= L , if and only if

LSC: only one drinkAC: trueAM: invariant I: permissive

User Vend. Ma.

E1

pSOFT

SOFT

SOFT

¬C50 ! ∧ ¬E1 !

false

am = initial am = invariant

ΘL

=cold

∃w ∈ W ∃m ∈ N0 •

∧w0 |= ac∧¬ψexit (CP

0 )∧ψprog(∅, CP

0 )

∧ w/1, . . . , w/m ∈ Lang(B(PC ))

∧ wm+1 |= ¬ψexit (CM

0 )

∧ wm+1 |= ψprog (∅, CM

0 )

∧ w/m+ 2 ∈ Lang(B(MC ))

∃w ∈ W ∃ k < m ∈ N0 •

∧wk |= ac∧¬ψexit (CP

0 )∧ψprog (∅, CP

0 )

∧ w/k + 1, . . . , w/m ∈ Lang(B(PC ))

∧ wm+1 |= ¬ψexit (CM

0 )

∧ wm+1 |= ψprog (∅, CM

0 )

∧ w/m+ 2 ∈ Lang(B(MC ))

ΘL

=hot

∀w ∈ W ∀m ∈ N0 •

∧w0 |= ac∧¬ψexit (CP

0 )∧ψprog(∅, CP

0 )

∧ w/1, . . . , w/m ∈ Lang(B(PC ))

∧ wm+1 |= ¬ψexit (CM

0 )

=⇒ wm+1 |= ψprog (∅, CM

0 )

∧ w/m + 2 ∈ Lang(B(MC ))

∀w ∈ W ∀ k ≤ m ∈ N0 •

∧wk |= ac∧¬ψexit (CP

0 )∧ψprog (∅, CP

0 )

∧ w/k + 1, . . . , w/m ∈ Lang(B(PC ))

∧ wm+1 |= ¬ψexit (CM

0 )

=⇒ wm+1 |= ψprog (∅, CM

0 )

∧ w/m + 2 ∈ Lang(B(MC ))

whereCP

0 andCM

0 are the minimal (or instance heads) cuts of pre- and main-chart.

westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
Page 8: Lecture 10: Requirements Engineering Wrap-Up · 2016-06-13 · –10 – 2016-06-13 – main– Softwaretechnik / Software-Engineering Lecture 10: Requirements Engineering Wrap-Up

Universal LSC: Example–

10–

20

16-0

6-1

3–

Sre

callp

c–

7/34

LSC: buy waterAC: trueAM: invariant I: strict

User CoinValidator ChoicePanel Dispenser

C50

pWATER

water_in_stock

dWATER

OK

westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
Page 9: Lecture 10: Requirements Engineering Wrap-Up · 2016-06-13 · –10 – 2016-06-13 – main– Softwaretechnik / Software-Engineering Lecture 10: Requirements Engineering Wrap-Up

Universal LSC: Example–

10–

20

16-0

6-1

3–

Sre

callp

c–

7/34

LSC: buy waterAC: trueAM: invariant I: strict

User CoinValidator ChoicePanel Dispenser

C50

pWATER

¬(C50 ! ∨ E1 ! ∨ pSOFT !

∨ pTEA! ∨ pFILLUP !)

water_in_stock

dWATER

OK¬(dSoft ! ∨ dTEA!)

Page 10: Lecture 10: Requirements Engineering Wrap-Up · 2016-06-13 · –10 – 2016-06-13 – main– Softwaretechnik / Software-Engineering Lecture 10: Requirements Engineering Wrap-Up

Requirements Engineering with Scenarios

–10

–2

016

-06

-13

–m

ain

8/34

Page 11: Lecture 10: Requirements Engineering Wrap-Up · 2016-06-13 · –10 – 2016-06-13 – main– Softwaretechnik / Software-Engineering Lecture 10: Requirements Engineering Wrap-Up

Requirements Engineering with Scenarios–

10–

20

16-0

6-1

3–

Sst

ren

gth

en

9/34

Needs!

need 1need 2need 3. . .

Solution!

Customer Developer

announcement(Lastenheft)

. . .eprop. 1prop. 2. . .

Customer Developer

offer(Pflichtenheft)

spec 1spec 2aspec 2b. . .§

. . .e

Customer Developer

software contract(incl. Pflichtenheft)

Needs!

Developer Customer

software delivery

One quite effective approach:

(i) Approximate the software requirements: ask for positive / negative existential scenarios.

(ii) Refine result into universal scenarios (and validate them with customer).

That is:

• Ask the customer to describe example usages of the desired system.

In the sense of: “If the system is not at all able to do this, then it’s not what I want.”

(→ positive use-cases, existential LSC)

• Ask the customer to describe behaviour that must not happen in the desired system.

In the sense of: “If the system does this, then it’s not what I want.”

(→ negative use-cases, LSC with pre-chart and hot-false)

• Investigate preconditions, side-conditions, exceptional cases and corner-cases.(→ extend use-cases, refine LSCs with conditions or local invariants)

• Generalise into universal requirements, e.g., universal LSCs.

• Validate with customer using new positive / negative scenarios.

Page 12: Lecture 10: Requirements Engineering Wrap-Up · 2016-06-13 · –10 – 2016-06-13 – main– Softwaretechnik / Software-Engineering Lecture 10: Requirements Engineering Wrap-Up

htt

ps:

//e

n.w

ikip

ed

ia.o

rg/

wik

i/M

erc

ed

es-

Be

nz_

S-C

lass

_%

28

W2

21%

29

#/m

ed

ia/

File

:Me

rce

de

s_W

22

1_d

rive

r%2

7s_

do

or_

con

tro

ls.JP

G–

Gu

ido

Gy

be

ls-

CC

BY

-SA

3.0

Strengthening Scenarios Into Requirements–

10–

20

16-0

6-1

3–

Sst

ren

gth

en

10/34

Needs!

need 1need 2need 3. . .

Solution!

Customer Developer

announcement(Lastenheft)

→. . .eprop. 1prop. 2. . .

Customer Developer

offer(Pflichtenheft)

spec 1spec 2aspec 2b. . .§

. . .e

Customer Developer

software contract(incl. Pflichtenheft)

Needs!

Developer Customer

software delivery

Page 13: Lecture 10: Requirements Engineering Wrap-Up · 2016-06-13 · –10 – 2016-06-13 – main– Softwaretechnik / Software-Engineering Lecture 10: Requirements Engineering Wrap-Up

Strengthening Scenarios Into Requirements–

10–

20

16-0

6-1

3–

Sst

ren

gth

en

10/34

Needs!

need 1need 2need 3. . .

Solution!

Customer Developer

announcement(Lastenheft)

→. . .eprop. 1prop. 2. . .

Customer Developer

offer(Pflichtenheft)

spec 1spec 2aspec 2b. . .§

. . .e

Customer Developer

software contract(incl. Pflichtenheft)

Needs!

Developer Customer

software delivery

• Ask customer for (pos./neg.) scenarios, note down as existential LSCs:

Button Controller

position 6= bottom

Motor Sensor

down pressed

move down

bottom reached

stop

Button Controller

position 6= bottom

Motor Sensor

down pressed

down released

move down

stop

Button Controller

position = bottom

Motor Sensor

down pressed

move down

false

position = bottom

westphal
Bleistift
Page 14: Lecture 10: Requirements Engineering Wrap-Up · 2016-06-13 · –10 – 2016-06-13 – main– Softwaretechnik / Software-Engineering Lecture 10: Requirements Engineering Wrap-Up

Strengthening Scenarios Into Requirements–

10–

20

16-0

6-1

3–

Sst

ren

gth

en

10/34

Needs!

need 1need 2need 3. . .

Solution!

Customer Developer

announcement(Lastenheft)

→. . .eprop. 1prop. 2. . .

Customer Developer

offer(Pflichtenheft)

spec 1spec 2aspec 2b. . .§

. . .e

Customer Developer

software contract(incl. Pflichtenheft)

Needs!

Developer Customer

software delivery

• Ask customer for (pos./neg.) scenarios, note down as existential LSCs:

Button Controller

position 6= bottom

Motor Sensor

down pressed

move down

bottom reached

stop

Button Controller

position 6= bottom

Motor Sensor

down pressed

down released

move down

stop

Button Controller

position = bottom

Motor Sensor

down pressed

move down

false

position = bottom

• Strengthen into requirements, note down as universal LSCs:

LSC: move down 1AM: invariant I: strict

Button Controller

position 6= bottom

Motor Sensor

down pressed

move down

bottom reached

stop

¬down_released

LSC: move down 2AM: invariant I: strict

Button Controller

position 6= bottom

Motor

down pressed

down released

move down

stop

¬bottom_reached

LSC: don’t moveAM: invariant I: strict

Button Controller

position = bottom

down pressed

down released

¬move_down

• Re-Discuss with customer using example words of the LSCs’ language.

Page 15: Lecture 10: Requirements Engineering Wrap-Up · 2016-06-13 · –10 – 2016-06-13 – main– Softwaretechnik / Software-Engineering Lecture 10: Requirements Engineering Wrap-Up

Analysing LSC Requiremnts–

10–

20

16-0

6-1

3–

Sst

ren

gth

en

11/34

Requirements on Requirements Specifications

–6

–2

016

-05

-12

–S

re–

12/37

A requirements specification should be

• correct— it correctly represents the wishes/needs ofthe customer,

• complete— all requirements (existing in somebody’shead, or a document, or . . . ) should be present,

• relevant— things which are not relevant to the projectshould not be constrained,

• consistent, free of contradictions— each requirement is compatible with all otherrequirements; otherwise the requirements arenot realisable,

• neutral, abstract— a requirements specification does notconstrain the realisation more than necessary,

• traceable, comprehensible— the sources of requirements are documented,requirements are uniquely identifiable,

• testable, objective— the final product can objectively be checkedfor satisfying a requirement.

• Correctness and completeness are defined relative to somethingwhich is usually only in the customer’s head.

→ is is difficult to be sure of correctness and completeness.

• “Dear customer, please tell me what is in your head!” is in almost all cases not a solution!

It’s not unusual that even the customer does not precisely know. . . !

For example, the customer may not be aware of contradictions due to technical limitations.

Definition. [LSC Consistency] A set of LSCs {L1, . . . ,Ln} is called consistentif and only if there exists a set of wordsW such that

∧n

i=1W |= Lang(Li).

westphal
Bleistift
Page 16: Lecture 10: Requirements Engineering Wrap-Up · 2016-06-13 · –10 – 2016-06-13 – main– Softwaretechnik / Software-Engineering Lecture 10: Requirements Engineering Wrap-Up

Content–

10–

20

16-0

6-1

3–

Sco

nte

nt

12/34

• Pre-Charts

• Semantics, once again

• Requirements Engineering with scenarios

• Strengthening scenarions into requirements

• Software, formally

• Software specification

• Requirements Engineering, formally

• Software implements specification

• LSCs vs. Software

• Software implements LSCs

• Scenarios and tests

• Play In/Play Out

• Requirements Engineering Wrap-Up

Page 17: Lecture 10: Requirements Engineering Wrap-Up · 2016-06-13 · –10 – 2016-06-13 – main– Softwaretechnik / Software-Engineering Lecture 10: Requirements Engineering Wrap-Up

Software and Software Specification, formally

–10

–2

016

-06

-13

–m

ain

13/34

Page 18: Lecture 10: Requirements Engineering Wrap-Up · 2016-06-13 · –10 – 2016-06-13 – main– Softwaretechnik / Software-Engineering Lecture 10: Requirements Engineering Wrap-Up

Software, formally–

10–

20

16-0

6-1

3–

Ssw

lsc

14/34

Definition. Software is a finite description S of a (possibly infinite)set JSK of (finite or infinite) computation paths of the form

σ0

α1−−→ σ1

α2−−→ σ2 · · ·

where

• σi ∈ Σ, i ∈ N0, is called state (or configuration), and

• αi ∈ A, i ∈ N0, is called action (or event).

The (possibly partial) function J · K : S 7→ JSK is called interpretation of S.

westphal
Bleistift
Page 19: Lecture 10: Requirements Engineering Wrap-Up · 2016-06-13 · –10 – 2016-06-13 – main– Softwaretechnik / Software-Engineering Lecture 10: Requirements Engineering Wrap-Up

Example: Software, formally–

10–

20

16-0

6-1

3–

Ssw

lsc

15/34

Software is a finite descriptionS of a (possibly infinite) set JSK of (finite or infinite) computation paths

of the form σ0

α1−−→ σ1

α2−−→ σ2· · · . σi: state/configuration; αi: action/event.

• Java Programs.

1: public int f( int x, int y ) {

2: x = x + y;

3: y = x / 2;

4: return y;

5: }

westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
Page 20: Lecture 10: Requirements Engineering Wrap-Up · 2016-06-13 · –10 – 2016-06-13 – main– Softwaretechnik / Software-Engineering Lecture 10: Requirements Engineering Wrap-Up

Example: Software, formally–

10–

20

16-0

6-1

3–

Ssw

lsc

15/34

Software is a finite descriptionS of a (possibly infinite) set JSK of (finite or infinite) computation paths

of the form σ0

α1−−→ σ1

α2−−→ σ2· · · . σi: state/configuration; αi: action/event.

• Java Programs.

• HTML.

1: <html>

2: <head>

3: <title>SWT 2016</title>

4: </head>

5: <body/>

6: </html>

westphal
Bleistift
westphal
Bleistift
Page 21: Lecture 10: Requirements Engineering Wrap-Up · 2016-06-13 · –10 – 2016-06-13 – main– Softwaretechnik / Software-Engineering Lecture 10: Requirements Engineering Wrap-Up

Example: Software, formally–

10–

20

16-0

6-1

3–

Ssw

lsc

15/34

Software is a finite descriptionS of a (possibly infinite) set JSK of (finite or infinite) computation paths

of the form σ0

α1−−→ σ1

α2−−→ σ2· · · . σi: state/configuration; αi: action/event.

• Java Programs.

• HTML.

• User’s Manual.

• etc. etc.

Page 22: Lecture 10: Requirements Engineering Wrap-Up · 2016-06-13 · –10 – 2016-06-13 – main– Softwaretechnik / Software-Engineering Lecture 10: Requirements Engineering Wrap-Up

Software Specification, formally–

10–

20

16-0

6-1

3–

Ssw

lsc

16/34

Needs!

need 1need 2need 3. . .

Solution!

Customer Developer

announcement(Lastenheft)

→. . .eprop. 1prop. 2. . .

Customer Developer

offer(Pflichtenheft)

spec 1spec 2aspec 2b. . .§

. . .e

Customer Developer

software contract(incl. Pflichtenheft)

Needs!

Developer Customer

software delivery

Definition. A software specification is a finite description S

of a (possibly infinite) set JS K of softwares, i.e.

JS K = {(S1, J · K1), . . . }.

The (possibly partial) function J · K : S 7→ JS K is called interpretation of S .

westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
Page 23: Lecture 10: Requirements Engineering Wrap-Up · 2016-06-13 · –10 – 2016-06-13 – main– Softwaretechnik / Software-Engineering Lecture 10: Requirements Engineering Wrap-Up

Example: Software Specification–

10–

20

16-0

6-1

3–

Ssw

lsc

17/34

htt

p:/

/co

mm

on

s.w

ikim

ed

ia.o

rg(C

C-b

y-s

a4

.0, D

irk

Ingo

Fran

ke)

Alphabet:

• M – dispense cash only,

• C – return card only,

• MC

– dispense cash and return card.

• Customer 1: “don’t care”

S1 =(

M.C

∣C.M

MC

• Customer 2: “you choose, but be consistent”

S2 = (M.C)ω or (C.M)ω

• Customer 3: “consider human errors”

S3 = (C.M)ω

Page 24: Lecture 10: Requirements Engineering Wrap-Up · 2016-06-13 · –10 – 2016-06-13 – main– Softwaretechnik / Software-Engineering Lecture 10: Requirements Engineering Wrap-Up

More Examples: Software Specification, formally–

10–

20

16-0

6-1

3–

Ssw

lsc

18/34

A software specification is a finite description S of a set JS K of softwares {(S1, J · K1), . . . }.

• Decision Tables.

T : room ventilation r1 r2 r3

b button pressed? × × −

off ventilation off? × − ∗

on ventilation on? − × ∗

go start ventilation × − −

stop stop ventilation − × −

westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
Page 25: Lecture 10: Requirements Engineering Wrap-Up · 2016-06-13 · –10 – 2016-06-13 – main– Softwaretechnik / Software-Engineering Lecture 10: Requirements Engineering Wrap-Up

More Examples: Software Specification, formally–

10–

20

16-0

6-1

3–

Ssw

lsc

18/34

A software specification is a finite description S of a set JS K of softwares {(S1, J · K1), . . . }.

• Decision Tables.

• LSCs.LSC: get changeAC: trueAM: invariant I: permissive

User Vend. Ma.

C50

E1

pSOFT

SOFT

chg-C50

LSC: only one drinkAC: trueAM: invariant I: permissive

User Vend. Ma.

E1

pSOFT

SOFT

SOFT

¬C50 ! ∧ ¬E1 !

false

Page 26: Lecture 10: Requirements Engineering Wrap-Up · 2016-06-13 · –10 – 2016-06-13 – main– Softwaretechnik / Software-Engineering Lecture 10: Requirements Engineering Wrap-Up

More Examples: Software Specification, formally–

10–

20

16-0

6-1

3–

Ssw

lsc

18/34

A software specification is a finite description S of a set JS K of softwares {(S1, J · K1), . . . }.

• Decision Tables.

• LSCs.

• Global Invariants.

x ≥ 0

Page 27: Lecture 10: Requirements Engineering Wrap-Up · 2016-06-13 · –10 – 2016-06-13 – main– Softwaretechnik / Software-Engineering Lecture 10: Requirements Engineering Wrap-Up

More Examples: Software Specification, formally–

10–

20

16-0

6-1

3–

Ssw

lsc

18/34

A software specification is a finite description S of a set JS K of softwares {(S1, J · K1), . . . }.

• Decision Tables.

• LSCs.

• Global Invariants.

• State Machines.

→ later

Page 28: Lecture 10: Requirements Engineering Wrap-Up · 2016-06-13 · –10 – 2016-06-13 – main– Softwaretechnik / Software-Engineering Lecture 10: Requirements Engineering Wrap-Up

More Examples: Software Specification, formally–

10–

20

16-0

6-1

3–

Ssw

lsc

18/34

A software specification is a finite description S of a set JS K of softwares {(S1, J · K1), . . . }.

• Decision Tables.

• LSCs.

• Global Invariants.

• State Machines.

• Java Programs.

1: public int f( int x, int y ) {

2: x = x + y;

3: y = x / 2;

4: return y;

5: }

westphal
Bleistift
Page 29: Lecture 10: Requirements Engineering Wrap-Up · 2016-06-13 · –10 – 2016-06-13 – main– Softwaretechnik / Software-Engineering Lecture 10: Requirements Engineering Wrap-Up

More Examples: Software Specification, formally–

10–

20

16-0

6-1

3–

Ssw

lsc

18/34

A software specification is a finite description S of a set JS K of softwares {(S1, J · K1), . . . }.

• Decision Tables.

• LSCs.

• Global Invariants.

• State Machines.

• Java Programs.

• User’s Manual.

• etc. etc.

Page 30: Lecture 10: Requirements Engineering Wrap-Up · 2016-06-13 · –10 – 2016-06-13 – main– Softwaretechnik / Software-Engineering Lecture 10: Requirements Engineering Wrap-Up

The Requirements Engineering Problem Formally–

10–

20

16-0

6-1

3–

Ssw

lsc

19/34

(Σ× A)ωall computation

paths over Σ andA,aka. chaos

requirements, allthese computationpaths are allowed(maybe including

refinements)

one software (= setof computation

paths) which satisfiesthe requirements

one software whichdoes not satisfy the

requirements

• Requirements engineering:

Describe/specify the set of the allowed softwares as S .

Note: what is not constrained is allowed, usually!

• Software development:

Create one software S whose computation paths JSK are all allowed, i.e. JSK ∈ S .

• Note: different programs in different programming languages may describe the same JSK.

• Often allowed: any refinement of (→ in a minute; e.g. allow intermediate transitions).

westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
Page 31: Lecture 10: Requirements Engineering Wrap-Up · 2016-06-13 · –10 – 2016-06-13 – main– Softwaretechnik / Software-Engineering Lecture 10: Requirements Engineering Wrap-Up

Software Specification vs. Software–

10–

20

16-0

6-1

3–

Ssw

lsc

20/34

σ00

α01−−→ σ0

1

α02−−→ σ0

2 · · ·

S = {(S0, J · K0)}

σ10

α11−−→ σ1

1

α12−−→ σ1

2 · · ·

(S1, J · K1)}

σ20

α21−−→ σ2

1

α22−−→ σ2

2 · · ·

(S2, J · K2)}

I

M

S1 implements S

via I andM

I ′

M ′

S2 implements S

via I andM

westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Bleistift
westphal
Pencil
westphal
Pencil
Page 32: Lecture 10: Requirements Engineering Wrap-Up · 2016-06-13 · –10 – 2016-06-13 – main– Softwaretechnik / Software-Engineering Lecture 10: Requirements Engineering Wrap-Up

LSCs vs. Software

–10

–2

016

-06

-13

–m

ain

21/34

Page 33: Lecture 10: Requirements Engineering Wrap-Up · 2016-06-13 · –10 – 2016-06-13 – main– Softwaretechnik / Software-Engineering Lecture 10: Requirements Engineering Wrap-Up

LSCs as Software Specification–

10–

20

16-0

6-1

3–

Ste

stp

lay

22/34

A software S is called compatible with LSC L over C and E is if and only if

• Σ = (C → B), i.e. the states are valuations of the conditions in C,

• A ⊆ E!? , i.e. the events are of the formE!, E? (viewed as a valuation of E!, E?).

A computation path π = σ0

α1−−→ σ1

α2−−→ σ2· · · ∈ JSK of software S induces the word

w(π) = (σ0 ∪ α1), (σ1 ∪ α2), (σ2 ∪ α3), . . . ,

we useWS to denote the set of words induced by JSK.

We say software S satisfies LSC L (without pre-chart), denoted by S |= L , if and only if

ΘL am = initial am = invariant

cold

∃w ∈WS • w0 |= ac ∧ ¬ψexit (C0)

∧ w0 |= ψprog (∅, C0) ∧ w/1 ∈ Lang(B(L ))

∃w ∈WS ∃ k ∈ N0 • wk |= ac ∧ ¬ψexit (C0)

∧ wk |= ψprog (∅, C0) ∧w/k + 1 ∈ Lang(B(L ))

hot ∀w ∈WS • w0 |= ac ∧ ¬ψexit (C0)

=⇒ w0 |= ψprog (∅, C0)∧w/1 ∈ Lang(B(L ))

∀w ∈WS ∀ k ∈ N0 • wk |= ac ∧ ¬ψexit (C0)

=⇒ wk |= ψCondhot

(∅, C0)∧w/k+1 ∈ Lang(B(L ))

Software S satisfies a set of LSCs L1, . . . ,Ln if and only if S |= Li for all 1 ≤ i ≤ n.

westphal
Bleistift
westphal
Bleistift
Page 34: Lecture 10: Requirements Engineering Wrap-Up · 2016-06-13 · –10 – 2016-06-13 – main– Softwaretechnik / Software-Engineering Lecture 10: Requirements Engineering Wrap-Up

How to Prove that a Software Satisfies an LSC?–

10–

20

16-0

6-1

3–

Ste

stp

lay

23/34

LSC: buy softdrinkAC: trueAM: invariant I: permissive

User Vend. Ma.

E1

pSOFT

SOFT

LSC: get changeAC: trueAM: invariant I: permissive

User Vend. Ma.

C50

E1

pSOFT

SOFT

chg-C50

• Software S satisfies existential LSC L if there exists π ∈ JSKsuch that L acceptsw(π). Prove S |= L by demonstrating π.

• Note: Existential LSCs∗ may hint at test-cases for the acceptance test!(∗: as well as (positive) scenarios in general, like use-cases)

requirementsfixed

requirementsfixed

acceptanceacceptance

systemspecifiedsystem

specifiedsystem

deliveredsystem

delivered

architecturedesigned

architecturedesigned

systemintegrated

systemintegrated

modulesdesignedmodulesdesigned

systemrealisedsystemrealised

verification & validation

Page 35: Lecture 10: Requirements Engineering Wrap-Up · 2016-06-13 · –10 – 2016-06-13 – main– Softwaretechnik / Software-Engineering Lecture 10: Requirements Engineering Wrap-Up

How to Prove that a Software Satisfies an LSC?–

10–

20

16-0

6-1

3–

Ste

stp

lay

23/34

LSC: buy softdrinkAC: trueAM: invariant I: permissive

User Vend. Ma.

E1

pSOFT

SOFT

LSC: get changeAC: trueAM: invariant I: permissive

User Vend. Ma.

C50

E1

pSOFT

SOFT

chg-C50

• Software S satisfies existential LSC L if there exists π ∈ JSKsuch that L acceptsw(π). Prove S |= L by demonstrating π.

• Note: Existential LSCs∗ may hint at test-cases for the acceptance test!(∗: as well as (positive) scenarios in general, like use-cases)

requirementsfixed

requirementsfixed

acceptanceacceptance

systemspecifiedsystem

specifiedsystem

deliveredsystem

delivered

architecturedesigned

architecturedesigned

systemintegrated

systemintegrated

modulesdesignedmodulesdesigned

systemrealisedsystemrealised

verification & validation

LSC: only one drinkAC: trueAM: invariant I: permissive

User Vend. Ma.

E1

pSOFT

SOFT

SOFT

¬C50 ! ∧ ¬E1 !

false

LSC: buy waterAC: trueAM: invariant I: strict

User CoinValidator ChoicePanel Dispenser

C50

pWATER

¬(C50 ! ∨ E1 ! ∨ pSOFT !

∨ pTEA! ∨ pFILLUP !)

water_in_stock

dWATER

OK

¬(dSoft ! ∨ dTEA!)

• Universal LSCs (and negative/anti-scenarios!) in general need an exhaustive analysis!(Because they require that the software never ever exhibits the unwanted behaviour.)

Prove S 6|= L by demonstrating one π such thatw(π) is not accepted by L .

Page 36: Lecture 10: Requirements Engineering Wrap-Up · 2016-06-13 · –10 – 2016-06-13 – main– Softwaretechnik / Software-Engineering Lecture 10: Requirements Engineering Wrap-Up

Pushing It Even Further–

10–

20

16-0

6-1

3–

Ste

stp

lay

24/34

(Harel and Marelly, 2003)

Page 37: Lecture 10: Requirements Engineering Wrap-Up · 2016-06-13 · –10 – 2016-06-13 – main– Softwaretechnik / Software-Engineering Lecture 10: Requirements Engineering Wrap-Up

Tell Them What You’ve Told Them. . .–

10–

20

16-0

6-1

3–

Stt

wy

tt–

25/34

• Live Sequence Charts (if well-formed)

• have an abstract syntax: instance lines, messages, conditions,local invariants; mode: hot or cold.

• From an abstract syntax, mechanically construct its TBA.

• Pre-charts allow us to

• specify anti-scenarios (“this must not happen”),

• contrain activation.

• An LSC is satisfied by a software S if and only if

• existential (cold):

• there is a word induced by a computation path of S

• which is accepted by the LSC’s pre/main-chart TBA.

• universal (hot):

• all words induced by the computation paths of S

• are accepted by the LSC’s pre/main-chart TBA.

• Method:

• discuss (anti-)scenarios with customer,

• generalise into universal LSCs and re-validate.

Page 38: Lecture 10: Requirements Engineering Wrap-Up · 2016-06-13 · –10 – 2016-06-13 – main– Softwaretechnik / Software-Engineering Lecture 10: Requirements Engineering Wrap-Up

Requirements Engineering Wrap-Up

–10

–2

016

-06

-13

–m

ain

26/34

Page 39: Lecture 10: Requirements Engineering Wrap-Up · 2016-06-13 · –10 – 2016-06-13 – main– Softwaretechnik / Software-Engineering Lecture 10: Requirements Engineering Wrap-Up

Topic Area Requirements Engineering: Content–

10–

20

16-0

6-1

3–

Sb

lock

con

ten

t–

27/34

• Introduction

• Requirements Specification

• Desired Properties

• Kinds of Requirements

• Analysis Techniques

• Documents

• Dictionary, Specification

• Specification Languages

• Natural Language

• Decision Tables

• Syntax, Semantics

• Completeness, Consistency, . . .

• Scenarios

• User Stories, Use Cases

• Live Sequence Charts

• Syntax, Semantics

• Definition: Software & SW Specification

• Wrap-Up

VL 6

.

..

VL 7

.

..

VL 8...

VL 9...

VL 10...

Page 40: Lecture 10: Requirements Engineering Wrap-Up · 2016-06-13 · –10 – 2016-06-13 – main– Softwaretechnik / Software-Engineering Lecture 10: Requirements Engineering Wrap-Up

Example: Software Specification–

10–

20

16-0

6-1

3–

Sw

rap

up

28/34

htt

p:/

/co

mm

on

s.w

ikim

ed

ia.o

rg(C

C-b

y-s

a4

.0, D

irk

Ingo

Fran

ke)

Alphabet:

• M – dispense cash only,

• C – return card only,

• MC

– dispense cash and return card.

• Customer 1: “don’t care”

S1 =(

M.C

∣C.M

MC

• Customer 2: “you choose, but be consistent”

S2 = (M.C)ω or (C.M)ω

• Customer 3: “consider human errors”

S3 = (C.M)ω

Page 41: Lecture 10: Requirements Engineering Wrap-Up · 2016-06-13 · –10 – 2016-06-13 – main– Softwaretechnik / Software-Engineering Lecture 10: Requirements Engineering Wrap-Up

Formal Methods in the Software Development Process–

10–

20

16-0

6-1

3–

Sw

rap

up

29/34

Customer 2

Mmmh,

Software!

Requirements

JS1K = {(M.C, J · K1), (C.M, J · K1)}

Design

JS2K = {(M.TM .C, J · K1), (C.TC .M, J · K1)}

Implementation

JSK = {σ0

α1−−→ σ1

α2−−→ σ2 · · · , . . . }

DevelopmentProcess/ Project

Management

validate

analyse

verify

analyse

verify

analyse

Page 42: Lecture 10: Requirements Engineering Wrap-Up · 2016-06-13 · –10 – 2016-06-13 – main– Softwaretechnik / Software-Engineering Lecture 10: Requirements Engineering Wrap-Up

Tell Them What You’ve Told Them. . .–

10–

20

16-0

6-1

3–

Sw

rap

up

30/34

• A Requirements Specification should be

• correct, complete, relevant, consistent,neutral, traceable, objective.

• Requirements Representations should be

• easily understandable, precise,easily maintainable, easily usable.

• Languages / Notations for Requirements Representations:

• Natural Language Patterns

• Decision Tables

• User Stories

• Use Cases

• Live Sequence Charts

• Formal representations

• can be very precise, objective, testable,

• can be analysed for, e.g., completeness, consistency

• can be verified against a formal design description.

(Formal) inconsistency of, e.g., a decision table

hints at inconsistencies in the requirements.

westphal
Bleistift
Page 43: Lecture 10: Requirements Engineering Wrap-Up · 2016-06-13 · –10 – 2016-06-13 – main– Softwaretechnik / Software-Engineering Lecture 10: Requirements Engineering Wrap-Up

Requirements Analysis in a Nutshell–

10–

20

16-0

6-1

3–

Sw

rap

up

31/34

• Customers may not know what they want.

• That’s in general not their “fault”!

• Care for tacit requirements.

• Care for non-functional requirements / constraints.

• For requirements elicitation, consider starting with

• scenarios (“positive use case”) and anti-scenarios (“negative use case”)

and elaborate corner cases.

Thus, use cases can be very useful — use case diagrams not so much.

• Maintain a dictionary and high-quality descriptions.

• Care for objectiveness / testability early on.

Ask for each requirements: what is the acceptance test?

• Use formal notations

• to fully understand requirements (precision),

• for requirements analysis (completeness, etc.),

• to communicate with your developers.

• If in doubt, complement (formal) diagrams with text(as safety precaution, e.g., in lawsuits).

Page 44: Lecture 10: Requirements Engineering Wrap-Up · 2016-06-13 · –10 – 2016-06-13 – main– Softwaretechnik / Software-Engineering Lecture 10: Requirements Engineering Wrap-Up

Literature Recommendation–

10–

20

16-0

6-1

3–

Sw

rap

up

32/34

(Rupp and die SOPHISTen, 2014)

Page 45: Lecture 10: Requirements Engineering Wrap-Up · 2016-06-13 · –10 – 2016-06-13 – main– Softwaretechnik / Software-Engineering Lecture 10: Requirements Engineering Wrap-Up

References

–10

–2

016

-06

-13

–m

ain

33/34

Page 46: Lecture 10: Requirements Engineering Wrap-Up · 2016-06-13 · –10 – 2016-06-13 – main– Softwaretechnik / Software-Engineering Lecture 10: Requirements Engineering Wrap-Up

References–

10–

20

16-0

6-1

3–

mai

n–

34/34

Harel, D. and Marelly, R. (2003). Come, Let’s Play: Scenario-Based Programming Using LSCs and the Play-Engine.Springer-Verlag.

Ludewig, J. and Lichter, H. (2013). Software Engineering. dpunkt.verlag, 3. edition.

Rupp, C. and die SOPHISTen (2014). Requirements-Engineering und -Management. Hanser, 6th edition.