Softwaretechnik / Software-Engineering Lecture 10: Live Sequence Charts Cont’d 2015-06-15 Prof. Dr. Andreas Podelski, Dr. Bernd Westphal – 10 – 2015-06-15 – main – Albert-Ludwigs-Universit¨ at Freiburg, Germany
Contents & Goals Last Lecture: • TBA: automata for infinite words • Cuts and firedsets of an LSC body • TBA-construction for LSC body This Lecture: • Educational Objectives: Capabilities for following tasks/questions. • what is the existential/universal, initial/invariant interpretation of an LSC? • Given a set of LSCs, give a computation path which is (not) accepted by the LSCs. • Given a set of LSCs, which scenario/anti-scenario/requirement is formalised by them? • Formalise this positive scenario/anti-scenario/requirement using LSCs. • Could there be a relation between LSC (anti-)scenarios and testing? – 10 – 2015-06-15 – Sprelim – • Content: • Full LSCs • Existential LSCs (scenarios) • pre-charts, universal LSCs • Requirements Engineering: conclusions 2 /31
Recall: TBA Construction and Full LSC Finally: The LSC Semantics A full LSC L = ((( L , � , ∼ ) , I , Msg , Cond , LocInv , Θ) , ac 0 , am , Θ L ) consist of • body (( L , � , ∼ ) , I , Msg , Cond , LocInv , Θ) , • activation condition ac 0 ∈ Φ( C ) , strictness flag strict (otherwise called permissive ) • activation mode am ∈ { initial , invariant } , • chart mode existential ( Θ L = cold) or universal ( Θ L = hot). Concrete syntax: LSC: L 1 AC: c 1 AM: initial I: permissive I 1 I 2 I 3 – 10 – 2015-06-15 – main – E – 09 – 2015-06-11 – Slscsem – F G 23 /50 3 /31
Finally: The LSC Semantics A full LSC L = ((( L , � , ∼ ) , I , Msg , Cond , LocInv , Θ) , ac 0 , am , Θ L ) consist of • body (( L , � , ∼ ) , I , Msg , Cond , LocInv , Θ) , • activation condition ac 0 ∈ Φ( C ) , strictness flag strict (otherwise called permissive ) • activation mode am ∈ { initial , invariant } , • chart mode existential ( Θ L = cold) or universal ( Θ L = hot). A set of words W ⊆ ( C → B ) ω is accepted by L if and only if Θ L am = initial am = invariant ∃ w ∈ W • w 0 | ∃ w ∈ W ∃ k ∈ N 0 • w k | = ac ∧ = ac ∧ cold w 0 | w k | = ψ Cond = ψ Cond hot ( ∅ , C 0 ) ∧ w/ 1 ∈ Lang ( B ( L )) hot ( ∅ , C 0 ) ∧ w/k +1 ∈ Lang ( B ( L )) – 10 – 2015-06-15 – Sflscsem – ∀ w ∈ W • w 0 | ∀ w ∈ W ∀ k ∈ N 0 • w k | ⇒ ⇒ = ac = = ac = hot w 0 | w k | = ψ Cond = ψ Cond hot ( ∅ , C 0 ) ∧ w/ 1 ∈ Lang ( B ( L )) hot ( ∅ , C 0 ) ∧ w/k +1 ∈ Lang ( B ( L )) where ac = ac 0 ∧ ψ Cond cold ( ∅ , C 0 ) ∧ ψ Msg ( ∅ , C 0 ) ; C 0 is the minimal (or instance heads ) cut. 4 /31
Activation Condition LSC: L 1 AC: c 1 AM: initial I: permissive I 1 I 2 I 3 E F G LSC: L 1 AM: initial I: permissive I 1 I 2 I 3 c 1 E – 10 – 2015-06-15 – Sflscsem – F G 5 /31
– 10 – 2015-06-15 – main – LSCs vs. Software 6 /31
LSCs vs. Software α 1 α 2 Let S be a software with � S � = { π = σ 0 − − → σ 1 − − → σ 2 · · · | · · · } . 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 form E ! , E ? . Construct letters by joining σ i and α i +1 (viewed as a valuation of E ! , E ? ): w ( π ) = ( σ 0 ∪ α 1 ) , ( σ 1 ∪ α 2 ) , ( σ 2 ∪ α 3 ) , . . . – 10 – 2015-06-15 – Sswlsc – 7 /31
LSCs vs. Software α 1 α 2 Let S be a software with � S � = { π = σ 0 − − → σ 1 − − → σ 2 · · · | · · · } . 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 form E ! , E ? . Construct letters by joining σ i and α i +1 (viewed as a valuation of E ! , E ? ): w ( π ) = ( σ 0 ∪ α 1 ) , ( σ 1 ∪ α 2 ) , ( σ 2 ∪ α 3 ) , . . . We say S satisfies LSC L (e.g. universal, invariant), denoted by S | = L , if and only if ∀ π ∈ � S � ∀ k ∈ N 0 • w ( π ) k | ⇒ w ( π ) k | = ψ Cond = ac = hot ( ∅ , C 0 ) ∧ w ( π ) /k + 1 ∈ Lang ( B ( L )) Θ L am = initial am = invariant ∃ w ∈ W • w 0 | ∃ w ∈ W ∃ k ∈ N 0 • w k | = ac ∧ = ac ∧ cold w 0 | w k | – 10 – 2015-06-15 – Sswlsc – = ψ Cond = ψ Cond hot ( ∅ , C 0 ) ∧ w/ 1 ∈ Lang ( B ( L )) hot ( ∅ , C 0 ) ∧ w/k +1 ∈ Lang ( B ( L )) ∀ w ∈ W • w 0 | ∀ w ∈ W ∀ k ∈ N 0 • w k | = ac = ⇒ = ac = ⇒ hot w 0 | w k | = ψ Cond = ψ Cond hot ( ∅ , C 0 ) ∧ w/ 1 ∈ Lang ( B ( L )) hot ( ∅ , C 0 ) ∧ w/k +1 ∈ Lang ( B ( L )) Software S satisfies a set of LSCs L 1 , . . . , L n if and only if S | = L i for all 1 ≤ i ≤ n . 7 /31
Recall: The Crux of Requirements Engineering (Σ × A ) ω ?! Customer Analyst requirements analysis One quite effective approach: try to approximate the requirements with positive and negative scenarios . • Dear customer, please describe example usages of the desired system. – 10 – 2015-06-15 – Sswlsc – “If the system is not at all able to do this, then it’s not what I want.” • Dear customer, please describe behaviour that the desired system must not show. “If the system does this, then it’s not what I want.” • From there on, refine and generalise: what about exceptional cases? what about corner-cases? etc. 8 /31
Example: Buy A Softdrink LSC: buy softdrink AC: true AM: invariant I: permissive User Vend. Ma. E 1 pSOFT SOFT – 10 – 2015-06-15 – Sswlsc – 9 /31
Example: Get Change LSC: get change AC: true I: permissive AM: invariant User Vend. Ma. C 50 E 1 pSOFT SOFT chg - C50 – 10 – 2015-06-15 – Sswlsc – 10 /31
Example: Don’t Give Two Drinks LSC: only one drink AC: true I: permissive AM: invariant User Vend. Ma. E 1 pSOFT SOFT ¬ C50 ! ∧ ¬ E1 ! SOFT – 10 – 2015-06-15 – Sprechart – false 11 /31
Pre-Charts LSC: only one drink AC: true AM: invariant I: permissive User Vend. Ma. E 1 pSOFT SOFT ¬ C50 ! ∧ ¬ E1 ! SOFT false A full LSC L = ( PC , MC , ac 0 , am , Θ L ) actually consist of • pre-chart PC = (( L P , � P , ∼ P ) , I P , Msg P , Cond P , LocInv P , Θ P ) (possibly empty), • main-chart MC = (( L M , � M , ∼ M ) , I M , Msg M , Cond M , LocInv M , Θ M ) (non-empty), • activation condition ac ∈ Φ( C ) , strictness flag strict (otherwise called permissive ) • activation mode am ∈ { initial , invariant } , – 10 – 2015-06-15 – Sprechart – • chart mode existential ( Θ L = cold) or universal ( Θ L = hot). 12 /31
Pre-Charts Semantics LSC: only one drink AC: true AM: invariant I: permissive User Vend. Ma. E 1 pSOFT SOFT ¬ C50 ! ∧ ¬ E1 ! SOFT false Θ L am = initial am = invariant ∃ w ∈ W ∃ m ∈ N 0 • w 0 | ∃ w ∈ W ∃ k < m ∈ N 0 • w k | = ac = ac ∧ w 0 | ∧ w k | = ψ Cond = ψ Cond hot ( ∅ , C P hot ( ∅ , C P 0 ) 0 ) cold ∧ w/ 1 , . . . , w/m ∈ Lang ( B ( PC )) ∧ w/k + 1 , . . . , w/m ∈ Lang ( B ( PC )) ∧ w m +1 | ∧ w m +1 | = ψ Cond hot ( ∅ , C M = ψ Cond hot ( ∅ , C M 0 ) 0 ) ∧ w/m + 1 ∈ Lang ( B ( MC )) ∧ w/m + 1 ∈ Lang ( B ( MC )) – 10 – 2015-06-15 – Sprechart – ∀ w ∈ W • w 0 | ∀ w ∈ W ∀ k ≤ m ∈ N 0 • w k | = ac = ac ∧ w 0 | ∧ w k | = ψ Cond = ψ Cond hot ( ∅ , C P hot ( ∅ , C P 0 ) 0 ) ∧ w/ 1 , . . . , w/m ∈ Lang ( B ( PC )) ∧ w/k + 1 , . . . , w/m ∈ Lang ( B ( PC )) hot ∧ w m +1 | ∧ w m +1 | = ψ Cond cold ( ∅ , C M = ψ Cond cold ( ∅ , C M 0 ) 0 ) ⇒ w m +1 | ⇒ w m +1 | = ψ Cond cold ( ∅ , C M = ψ Cond cold ( ∅ , C M = 0 ) = 0 ) ∧ w/m + 1 ∈ Lang ( B ( MC )) ∧ w/m + 1 ∈ Lang ( B ( MC )) 13 /31
Note: Scenarios and Acceptance Test LSC: get change LSC: only one drink AC: true AC: true AM: invariant I: permissive AM: invariant I: permissive User Vend. Ma. User Vend. Ma. LSC: buy softdrink C 50 E 1 AC: true AM: invariant I: permissive pSOFT E 1 User Vend. Ma. pSOFT E 1 SOFT ¬ C50 ! ∧ ¬ E1 ! pSOFT SOFT SOFT chg - C50 SOFT false • Existential LSCs ∗ may hint at test-cases for the acceptance test ! ( ∗ : as well as (positive) scenarios in general, like use-cases) – 10 – 2015-06-15 – Sprechart – • Universal LSCs (and negative/anti-scenarios) in general need exhaustive analysis ! (Because they require that the software never ever exhibits the unwanted behaviour.) 14 /31
Strenghening Scenarios Into Requirements (Σ × A ) ω (Σ × A ) ω Customer Analyst requirements analysis – 10 – 2015-06-15 – Sprechart – 15 /31
Universal LSC: Example LSC: buy water AC: true AM: invariant I: strict User CoinValidator ChoicePanel Dispenser C 50 pWATER water in stock dWATER OK – 10 – 2015-06-15 – Sprechart – 16 /31
Universal LSC: Example LSC: buy water AC: true AM: invariant I: strict User CoinValidator ChoicePanel Dispenser C 50 ¬ ( C50 ! ∨ E1 ! ∨ pSOFT ! pWATER ∨ pTEA ! ∨ pFILLUP ! water in stock dWATER OK – 10 – 2015-06-15 – Sprechart – 16 /31
Universal LSC: Example LSC: buy water AC: true AM: invariant I: strict User CoinValidator ChoicePanel Dispenser C 50 ¬ ( C50 ! ∨ E1 ! ∨ pSOFT ! pWATER ∨ pTEA ! ∨ pFILLUP ! water in stock dWATER ¬ ( dSoft ! ∨ dTEA !) OK – 10 – 2015-06-15 – Sprechart – 16 /31
Recommend
More recommend