Lecture 8: Use Cases and Scenarios 2017-06-01 Prof. Dr. Andreas - - PowerPoint PPT Presentation

lecture 8 use cases and scenarios
SMART_READER_LITE
LIVE PREVIEW

Lecture 8: Use Cases and Scenarios 2017-06-01 Prof. Dr. Andreas - - PowerPoint PPT Presentation

Softwaretechnik / Software-Engineering Lecture 8: Use Cases and Scenarios 2017-06-01 Prof. Dr. Andreas Podelski, Dr. Bernd Westphal Albert-Ludwigs-Universitt Freiburg, Germany 8 2017-06-01 main Topic Area Requirements


slide-1
SLIDE 1

– 8 – 2017-06-01 – main –

Softwaretechnik / Software-Engineering

Lecture 8: Use Cases and Scenarios

2017-06-01

  • Prof. Dr. Andreas Podelski, Dr. Bernd Westphal

Albert-Ludwigs-Universität Freiburg, Germany

slide-2
SLIDE 2

Topic Area Requirements Engineering: Content

– 8 – 2017-06-01 – Sblockcontent –

2/45

  • 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
  • Working Definition: Software
  • Discussion

VL 6 . . . VL 7 . . . VL 8 . . . VL 9 . . .

slide-3
SLIDE 3

Content

– 8 – 2017-06-01 – Scontent –

3/45

  • User Stories
  • Use Cases
  • Use Case Diagrams
  • Sequence Diagrams
  • A Brief History
  • Live Sequence Charts
  • Syntax:
  • Elements, Locations,
  • Towards Semantics:
  • Cuts
  • Firedsets
slide-4
SLIDE 4

Scenarios

– 8 – 2017-06-01 – main –

4/45

slide-5
SLIDE 5

Recall: The Crux of Requirements Engineering

– 8 – 2017-06-01 – Sscen –

5/45

Needs!

need 1 need 2 need 3 ...

Solution! Customer Developer

announcement

(Lastenheft)

...e

  • prop. 1
  • prop. 2
...

Customer Developer

  • ffer

(Pflichtenheft)

spec 1 spec 2a spec 2b ...

§

...e

Customer Developer

software contract

(incl. Pflichtenheft)

Needs! Developer Customer

software delivery

slide-6
SLIDE 6

Recall: The Crux of Requirements Engineering

– 8 – 2017-06-01 – Sscen –

5/45

Needs!

need 1 need 2 need 3 ...

Solution! Customer Developer

announcement

(Lastenheft)

...e

  • prop. 1
  • prop. 2
...

Customer Developer

  • ffer

(Pflichtenheft)

spec 1 spec 2a spec 2b ...

§

...e

Customer Developer

software contract

(incl. Pflichtenheft)

Needs! Developer Customer

software delivery

One quite effective approach: try to approximate the requirements with positive and negative scenarios.

slide-7
SLIDE 7

Recall: The Crux of Requirements Engineering

– 8 – 2017-06-01 – Sscen –

5/45

Needs!

need 1 need 2 need 3 ...

Solution! Customer Developer

announcement

(Lastenheft)

...e

  • prop. 1
  • prop. 2
...

Customer Developer

  • ffer

(Pflichtenheft)

spec 1 spec 2a spec 2b ...

§

...e

Customer Developer

software contract

(incl. Pflichtenheft)

Needs! Developer Customer

software delivery

One quite effective approach: try to approximate the requirements with positive and negative scenarios.

  • Dear customer, please describe example usages of the desired system.

Customer intuition: “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.

Customer intuition: “If the system does this, then it’s not what I want.”

slide-8
SLIDE 8

Recall: The Crux of Requirements Engineering

– 8 – 2017-06-01 – Sscen –

5/45

Needs!

need 1 need 2 need 3 ...

Solution! Customer Developer

announcement

(Lastenheft)

...e

  • prop. 1
  • prop. 2
...

Customer Developer

  • ffer

(Pflichtenheft)

spec 1 spec 2a spec 2b ...

§

...e

Customer Developer

software contract

(incl. Pflichtenheft)

Needs! Developer Customer

software delivery

One quite effective approach: try to approximate the requirements with positive and negative scenarios.

  • Dear customer, please describe example usages of the desired system.

Customer intuition: “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.

Customer intuition: “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.

  • Prominent early advocate: OOSE (Jacobson, 1992).
slide-9
SLIDE 9

Example: Vending Machine

– 8 – 2017-06-01 – Sscen –

6/45

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

slide-10
SLIDE 10

Example: Vending Machine

– 8 – 2017-06-01 – Sscen –

6/45

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

slide-11
SLIDE 11

Notations for Scenarios

– 8 – 2017-06-01 – Sscen –

7/45

  • The idea of scenarios (sometimes without negative or anti-scenarios)

(re-)occurs in many process models or software development approaches.

  • In the following, we will discuss two-and-a-half notations

(in increasing formality):

  • User Stories (part of Extreme Programming)
  • Use Cases and Use Case Diagrams (OOSE)
  • Sequence Diagrams (here: Live Sequence Charts (Damm and Harel, 2001))
slide-12
SLIDE 12

User Stories

– 8 – 2017-06-01 – main –

8/45

slide-13
SLIDE 13

User Stories (Beck, 1999)

– 8 – 2017-06-01 – Suserstories –

9/45

“A User Story is a concise, written description of a piece of functionality that will be valuable to a user (or owner) of the software.”

slide-14
SLIDE 14

User Stories (Beck, 1999)

– 8 – 2017-06-01 – Suserstories –

9/45

“A User Story is a concise, written description of a piece of functionality that will be valuable to a user (or owner) of the software.” Per user story, use one file card with the user story, e.g. following the pattern: As a [role] I want [something] so that [benefit].

slide-15
SLIDE 15

User Stories (Beck, 1999)

– 8 – 2017-06-01 – Suserstories –

9/45

“A User Story is a concise, written description of a piece of functionality that will be valuable to a user (or owner) of the software.” Per user story, use one file card with the user story, e.g. following the pattern: As a [role] I want [something] so that [benefit]. and in addition:

  • unique identifier (e.g. unique number),
  • priority (from 1 (highest) to 10 (lowest))

assigned by customer,

  • effort, estimated by developers,
  • back side of file card:

(acceptance) test case(s), i.e., how to tell whether the user story has been realised.

slide-16
SLIDE 16

User Stories (Beck, 1999)

– 8 – 2017-06-01 – Suserstories –

9/45

“A User Story is a concise, written description of a piece of functionality that will be valuable to a user (or owner) of the software.” Per user story, use one file card with the user story, e.g. following the pattern: As a [role] I want [something] so that [benefit]. and in addition:

  • unique identifier (e.g. unique number),
  • priority (from 1 (highest) to 10 (lowest))

assigned by customer,

  • effort, estimated by developers,
  • back side of file card:

(acceptance) test case(s), i.e., how to tell whether the user story has been realised.

Proposed card layout (front side):

priority unique identifier, name estimation As a [role] I want [something] so that [benefit]. risk real effort

slide-17
SLIDE 17

User Stories (Beck, 1999)

– 8 – 2017-06-01 – Suserstories –

9/45

“A User Story is a concise, written description of a piece of functionality that will be valuable to a user (or owner) of the software.” Per user story, use one file card with the user story, e.g. following the pattern: As a [role] I want [something] so that [benefit]. and in addition:

  • unique identifier (e.g. unique number),
  • priority (from 1 (highest) to 10 (lowest))

assigned by customer,

  • effort, estimated by developers,
  • back side of file card:

(acceptance) test case(s), i.e., how to tell whether the user story has been realised.

Proposed card layout (front side):

priority unique identifier, name estimation As a [role] I want [something] so that [benefit]. risk real effort

Natural Language Patterns

– 6 – 2016-05-12 – Sspeclang –

33/37

Natural language requirements can be (tried to be) written as an instance of the pattern “A B C D E F.” (German grammar) where

A clarifies when and under what conditions the activity takes place B is MUST (obligation), SHOULD (wish), or WILL (intention); also: MUST NOT (forbidden) C is either “the system” or the concrete name of a (sub-)system D

  • ne of three possibilities:
  • “does”, description of a system activity,
  • “offers”, description of a function offered by the system to somebody,
  • “is able if”,

usage of a function offered by a third party, under certain conditions E extensions, in particular an object F the actual process word (what happens)

(Rupp and die SOPHISTen, 2009)

Example:

After office hours (= A), the system (= C) should (= B) offer to the operator (= D) a backup (= F) of all new registrations to an external medium (= E).

slide-18
SLIDE 18

User Stories: Discussion

– 8 – 2017-06-01 – Suserstories –

10/45

✔ easy to create, small units ✔ close contact to customer ✔ objective / testable: by fixing test cases early ✘ may get difficult to keep overview over whole system to be developed → maybe best suited for changes / extensions (after first iteration). ✘ not designed to cover non-functional requirements and restrictions ✘ agile spirit: strong dependency on competent developers ✘ estimation of effort may be difficult

(Balzert, 2009)

slide-19
SLIDE 19

Use Cases

– 8 – 2017-06-01 – main –

11/45

slide-20
SLIDE 20

– 8 – 2017-06-01 – Suc –

12/45

slide-21
SLIDE 21

Use Case: Definition

– 8 – 2017-06-01 – Suc –

13/45 use case — A sequence of interactions between an actor (or actors) and a system trig- gered by a specific actor, which produces a result for an actor.

(Jacobson, 1992)

slide-22
SLIDE 22

Use Case: Definition

– 8 – 2017-06-01 – Suc –

13/45 use case — A sequence of interactions between an actor (or actors) and a system trig- gered by a specific actor, which produces a result for an actor.

(Jacobson, 1992)

More precisely:

  • A use case has participants:

the system and at least one actor.

  • Actor: an actor represents

what interacts with the system.

  • An actor is a role, which a user or an external

system may assume when interacting with the system under design.

  • Actors are not part of the system,

thus they are not described in detail.

  • Actions of actors are non-deterministic

(possibly constrained by domain model).

  • A use case is triggered by a stimulus

as input by the main actor.

  • A use case is goal oriented, i.e. the main actor

wants to reach a particular goal.

  • A use case describes all interactions between

the system and the participating actors that are needed to achieve the goal (or fail to achieve the goal for reasons).

  • A use case ends when the desired goal is

achieved, or when it is clear that the desired goal cannot be achieved.

slide-23
SLIDE 23

Use Case Example: ATM Authentication

– 8 – 2017-06-01 – Suc –

14/45

h t t p : / / c

  • m

m

  • n

s . w i k i m e d i a .

  • r

g ( C C

  • b

y

  • s

a 4 . , D i r k I n g

  • F

r a n k e )

slide-24
SLIDE 24

Use Case Example: ATM Authentication

– 8 – 2017-06-01 – Suc –

14/45

h t t p : / / c

  • m

m

  • n

s . w i k i m e d i a .

  • r

g ( C C

  • b

y

  • s

a 4 . , D i r k I n g

  • F

r a n k e )

name Authentication goal pre-condition post-condition post-cond. in exceptional case actors

  • pen questions

normal case

slide-25
SLIDE 25

Use Case Example: ATM Authentication

– 8 – 2017-06-01 – Suc –

14/45

h t t p : / / c

  • m

m

  • n

s . w i k i m e d i a .

  • r

g ( C C

  • b

y

  • s

a 4 . , D i r k I n g

  • F

r a n k e )

name Authentication goal the client wants access to the ATM pre-condition post-condition post-cond. in exceptional case actors

  • pen questions

normal case

slide-26
SLIDE 26

Use Case Example: ATM Authentication

– 8 – 2017-06-01 – Suc –

14/45

h t t p : / / c

  • m

m

  • n

s . w i k i m e d i a .

  • r

g ( C C

  • b

y

  • s

a 4 . , D i r k I n g

  • F

r a n k e )

name Authentication goal the client wants access to the ATM pre-condition the ATM is operational, the welcome screen is displayed, card and PIN of client are available post-condition post-cond. in exceptional case actors

  • pen questions

normal case

slide-27
SLIDE 27

Use Case Example: ATM Authentication

– 8 – 2017-06-01 – Suc –

14/45

h t t p : / / c

  • m

m

  • n

s . w i k i m e d i a .

  • r

g ( C C

  • b

y

  • s

a 4 . , D i r k I n g

  • F

r a n k e )

name Authentication goal the client wants access to the ATM pre-condition the ATM is operational, the welcome screen is displayed, card and PIN of client are available post-condition client accepted, services of ATM are offered post-cond. in exceptional case actors

  • pen questions

normal case

slide-28
SLIDE 28

Use Case Example: ATM Authentication

– 8 – 2017-06-01 – Suc –

14/45

h t t p : / / c

  • m

m

  • n

s . w i k i m e d i a .

  • r

g ( C C

  • b

y

  • s

a 4 . , D i r k I n g

  • F

r a n k e )

name Authentication goal the client wants access to the ATM pre-condition the ATM is operational, the welcome screen is displayed, card and PIN of client are available post-condition client accepted, services of ATM are offered post-cond. in exceptional case access denied, card returned or withheld, welcome screen displayed actors

  • pen questions

normal case

slide-29
SLIDE 29

Use Case Example: ATM Authentication

– 8 – 2017-06-01 – Suc –

14/45

h t t p : / / c

  • m

m

  • n

s . w i k i m e d i a .

  • r

g ( C C

  • b

y

  • s

a 4 . , D i r k I n g

  • F

r a n k e )

name Authentication goal the client wants access to the ATM pre-condition the ATM is operational, the welcome screen is displayed, card and PIN of client are available post-condition client accepted, services of ATM are offered post-cond. in exceptional case access denied, card returned or withheld, welcome screen displayed actors client (main actor), bank system

  • pen questions

normal case

slide-30
SLIDE 30

Use Case Example: ATM Authentication

– 8 – 2017-06-01 – Suc –

14/45

h t t p : / / c

  • m

m

  • n

s . w i k i m e d i a .

  • r

g ( C C

  • b

y

  • s

a 4 . , D i r k I n g

  • F

r a n k e )

name Authentication goal the client wants access to the ATM pre-condition the ATM is operational, the welcome screen is displayed, card and PIN of client are available post-condition client accepted, services of ATM are offered post-cond. in exceptional case access denied, card returned or withheld, welcome screen displayed actors client (main actor), bank system

  • pen questions

none normal case

slide-31
SLIDE 31

Use Case Example: ATM Authentication

– 8 – 2017-06-01 – Suc –

14/45

h t t p : / / c

  • m

m

  • n

s . w i k i m e d i a .

  • r

g ( C C

  • b

y

  • s

a 4 . , D i r k I n g

  • F

r a n k e )

name Authentication goal the client wants access to the ATM pre-condition the ATM is operational, the welcome screen is displayed, card and PIN of client are available post-condition client accepted, services of ATM are offered post-cond. in exceptional case access denied, card returned or withheld, welcome screen displayed actors client (main actor), bank system

  • pen questions

none normal case

  • 1. client inserts card
  • 2. ATM read card,

sends data to bank system

  • 3. bank system checks validity
  • 4. ATM shows PIN screen
  • 5. client enters PIN
  • 6. ATM reads PIN,

sends to bank system

  • 7. bank system checks PIN
  • 8. ATM accepts and shows main menu
slide-32
SLIDE 32

Use Case Example: ATM Authentication

– 8 – 2017-06-01 – Suc –

14/45

h t t p : / / c

  • m

m

  • n

s . w i k i m e d i a .

  • r

g ( C C

  • b

y

  • s

a 4 . , D i r k I n g

  • F

r a n k e )

name Authentication goal the client wants access to the ATM pre-condition the ATM is operational, the welcome screen is displayed, card and PIN of client are available post-condition client accepted, services of ATM are offered post-cond. in exceptional case access denied, card returned or withheld, welcome screen displayed actors client (main actor), bank system

  • pen questions

none normal case

  • 1. client inserts card
  • 2. ATM read card,

sends data to bank system

  • 3. bank system checks validity
  • 4. ATM shows PIN screen
  • 5. client enters PIN
  • 6. ATM reads PIN,

sends to bank system

  • 7. bank system checks PIN
  • 8. ATM accepts and shows main menu

exception case 2a card not readable 2a.1 ATM displays “card not readable” 2a.2 ATM returns card 2a.3 ATM shows welcome screen

slide-33
SLIDE 33

Use Case Example: ATM Authentication

– 8 – 2017-06-01 – Suc –

14/45

h t t p : / / c

  • m

m

  • n

s . w i k i m e d i a .

  • r

g ( C C

  • b

y

  • s

a 4 . , D i r k I n g

  • F

r a n k e )

name Authentication goal the client wants access to the ATM pre-condition the ATM is operational, the welcome screen is displayed, card and PIN of client are available post-condition client accepted, services of ATM are offered post-cond. in exceptional case access denied, card returned or withheld, welcome screen displayed actors client (main actor), bank system

  • pen questions

none normal case

  • 1. client inserts card
  • 2. ATM read card,

sends data to bank system

  • 3. bank system checks validity
  • 4. ATM shows PIN screen
  • 5. client enters PIN
  • 6. ATM reads PIN,

sends to bank system

  • 7. bank system checks PIN
  • 8. ATM accepts and shows main menu

exception case 2a card not readable 2a.1 ATM displays “card not readable” 2a.2 ATM returns card 2a.3 ATM shows welcome screen

  • exc. case 2b

card readable, but not ATM card

  • exc. case 2c

no connection to bank system

  • exc. case 3a

card not valid or disabled

  • exc. case 5a

client cancels

  • exc. case 5b

client doesn’t react within 5 s

  • exc. case 6a

no connection to bank system

  • exc. case 7a

first or second PIN wrong

  • exc. case 7b

third PIN wrong (Ludewig and Lichter, 2013)

slide-34
SLIDE 34

Use Case Diagrams

– 8 – 2017-06-01 – main –

15/45

slide-35
SLIDE 35

Use Case Diagrams: Basic Building Blocks

– 8 – 2017-06-01 – Sucd –

16/45

actor name use case name

  • r:

use case name

slide-36
SLIDE 36

Example: Use Case Diagram of the ATM Use Case

– 8 – 2017-06-01 – Sucd –

17/45

Use Case Example: ATM Authentication

– 8 – 2017-06-01 – Suc –

14/27

http://commons.wikimedia.org (CC-by-sa 4.0, Dirk Ingo Franke)

name Authentication goal the client wants access to the ATM pre-condition the ATM is operational, the welcome screen is displayed, card and PIN of client are available post-condition client accepted, services of ATM are offered post-cond. in exceptional case access denied, card returned or withheld, welcome screen displayed actors client (main actor), bank system

  • pen questions

none normal case

  • 1. client inserts card
  • 2. ATM read card,

sends data to bank system

  • 3. bank system checks validity
  • 4. ATM shows PIN screen
  • 5. client enters PIN
  • 6. ATM reads PIN,

sends to bank system

  • 7. bank system checks PIN
  • 8. ATM accepts and shows main menu

exception case 2a card not readable 2a.1 ATM displays “card not readable” 2a.2 ATM returns card 2a.3 ATM shows welcome screen

  • exc. case 2b

card readable, but not ATM card

  • exc. case 2c

no connection to bank system

  • exc. case 3a

card not valid or disabled

  • exc. case 5a

client cancels

  • exc. case 5b

client doesn’t react within 5 s

  • exc. case 6a

no connection to bank system

  • exc. case 7a

first or second PIN wrong

  • exc. case 7b

third PIN wrong (Ludewig and Lichter, 2013)

slide-37
SLIDE 37

Example: Use Case Diagram of the ATM Use Case

– 8 – 2017-06-01 – Sucd –

17/45

Use Case Example: ATM Authentication

– 8 – 2017-06-01 – Suc –

14/27

http://commons.wikimedia.org (CC-by-sa 4.0, Dirk Ingo Franke)

name Authentication goal the client wants access to the ATM pre-condition the ATM is operational, the welcome screen is displayed, card and PIN of client are available post-condition client accepted, services of ATM are offered post-cond. in exceptional case access denied, card returned or withheld, welcome screen displayed actors client (main actor), bank system

  • pen questions

none normal case

  • 1. client inserts card
  • 2. ATM read card,

sends data to bank system

  • 3. bank system checks validity
  • 4. ATM shows PIN screen
  • 5. client enters PIN
  • 6. ATM reads PIN,

sends to bank system

  • 7. bank system checks PIN
  • 8. ATM accepts and shows main menu

exception case 2a card not readable 2a.1 ATM displays “card not readable” 2a.2 ATM returns card 2a.3 ATM shows welcome screen

  • exc. case 2b

card readable, but not ATM card

  • exc. case 2c

no connection to bank system

  • exc. case 3a

card not valid or disabled

  • exc. case 5a

client cancels

  • exc. case 5b

client doesn’t react within 5 s

  • exc. case 6a

no connection to bank system

  • exc. case 7a

first or second PIN wrong

  • exc. case 7b

third PIN wrong (Ludewig and Lichter, 2013)

client (main actor) Authentication bank system

slide-38
SLIDE 38

Use Case Diagrams: More Building Blocks

– 8 – 2017-06-01 – Sucd –

18/45

actor name use case name

  • r:

use case name

slide-39
SLIDE 39

Use Case Diagrams: More Building Blocks

– 8 – 2017-06-01 – Sucd –

18/45

actor name use case name

  • r:

use case name

More notation:

use case A use case B

  • extends
  • use case A

use case B

  • uses
  • r

include

slide-40
SLIDE 40

Use Case Diagram: Bigger Examples

– 8 – 2017-06-01 – Sucd –

19/45 ATM info services

print statement [not auth.] query balance [print statement]

transactions

get cash define stan- ding order

basic services

authentication

  • extend
  • include
  • include
  • include
  • extend
  • (Ludewig and Lichter, 2013)
slide-41
SLIDE 41

Customer and Developer Happy?

– 8 – 2017-06-01 – Shappy –

20/45

Use Case Example: ATM Authentication

– 8 – 2017-06-01 – Suc –

14/27

http://commons.wikimedia.org (CC-by-sa 4.0, Dirk Ingo Franke)

name Authentication goal the client wants access to the ATM pre-condition the ATM is operational, the welcome screen is displayed, card and PIN of client are available post-condition client accepted, services of ATM are offered post-cond. in exceptional case access denied, card returned or withheld, welcome screen displayed actors client (main actor), bank system

  • pen questions

none normal case

  • 1. client inserts card
  • 2. ATM read card,

sends data to bank system

  • 3. bank system checks validity
  • 4. ATM shows PIN screen
  • 5. client enters PIN
  • 6. ATM reads PIN,

sends to bank system

  • 7. bank system checks PIN
  • 8. ATM accepts and shows main menu

exception case 2a card not readable 2a.1 ATM displays “card not readable” 2a.2 ATM returns card 2a.3 ATM shows welcome screen

  • exc. case 2b

card readable, but not ATM card

  • exc. case 2c

no connection to bank system

  • exc. case 3a

card not valid or disabled

  • exc. case 5a

client cancels

  • exc. case 5b

client doesn’t react within 5 s

  • exc. case 6a

no connection to bank system

  • exc. case 7a

first or second PIN wrong

  • exc. case 7b

third PIN wrong (Ludewig and Lichter, 2013)

slide-42
SLIDE 42

Customer and Developer Happy?

– 8 – 2017-06-01 – Shappy –

20/45

Use Case Example: ATM Authentication

– 8 – 2017-06-01 – Suc –

14/27

http://commons.wikimedia.org (CC-by-sa 4.0, Dirk Ingo Franke)

name Authentication goal the client wants access to the ATM pre-condition the ATM is operational, the welcome screen is displayed, card and PIN of client are available post-condition client accepted, services of ATM are offered post-cond. in exceptional case access denied, card returned or withheld, welcome screen displayed actors client (main actor), bank system

  • pen questions

none normal case

  • 1. client inserts card
  • 2. ATM read card,

sends data to bank system

  • 3. bank system checks validity
  • 4. ATM shows PIN screen
  • 5. client enters PIN
  • 6. ATM reads PIN,

sends to bank system

  • 7. bank system checks PIN
  • 8. ATM accepts and shows main menu

exception case 2a card not readable 2a.1 ATM displays “card not readable” 2a.2 ATM returns card 2a.3 ATM shows welcome screen

  • exc. case 2b

card readable, but not ATM card

  • exc. case 2c

no connection to bank system

  • exc. case 3a

card not valid or disabled

  • exc. case 5a

client cancels

  • exc. case 5b

client doesn’t react within 5 s

  • exc. case 6a

no connection to bank system

  • exc. case 7a

first or second PIN wrong

  • exc. case 7b

third PIN wrong (Ludewig and Lichter, 2013)

(1.) Observables:

  • event insert_card
  • condition card_rdbl
  • event send_data
  • event data_valid
  • event pin_screen
slide-43
SLIDE 43

Customer and Developer Happy?

– 8 – 2017-06-01 – Shappy –

20/45

Use Case Example: ATM Authentication

– 8 – 2017-06-01 – Suc –

14/27

http://commons.wikimedia.org (CC-by-sa 4.0, Dirk Ingo Franke)

name Authentication goal the client wants access to the ATM pre-condition the ATM is operational, the welcome screen is displayed, card and PIN of client are available post-condition client accepted, services of ATM are offered post-cond. in exceptional case access denied, card returned or withheld, welcome screen displayed actors client (main actor), bank system

  • pen questions

none normal case

  • 1. client inserts card
  • 2. ATM read card,

sends data to bank system

  • 3. bank system checks validity
  • 4. ATM shows PIN screen
  • 5. client enters PIN
  • 6. ATM reads PIN,

sends to bank system

  • 7. bank system checks PIN
  • 8. ATM accepts and shows main menu

exception case 2a card not readable 2a.1 ATM displays “card not readable” 2a.2 ATM returns card 2a.3 ATM shows welcome screen

  • exc. case 2b

card readable, but not ATM card

  • exc. case 2c

no connection to bank system

  • exc. case 3a

card not valid or disabled

  • exc. case 5a

client cancels

  • exc. case 5b

client doesn’t react within 5 s

  • exc. case 6a

no connection to bank system

  • exc. case 7a

first or second PIN wrong

  • exc. case 7b

third PIN wrong (Ludewig and Lichter, 2013)

(1.) Observables:

  • event insert_card
  • condition card_rdbl
  • event send_data
  • event data_valid
  • event pin_screen

(2.) Finite Automaton: q1 q2 q3 q4 q5

insert_card ∧ card_rdbl q insert_card ∧¬ card_rdbl send_data data_valid pin_screen

slide-44
SLIDE 44

– 8 – 2017-06-01 – Shappy –

21/45

slide-45
SLIDE 45

Content

– 8 – 2017-06-01 – Scontent –

22/45

  • User Stories
  • Use Cases
  • Use Case Diagrams
  • Sequence Diagrams
  • A Brief History
  • Live Sequence Charts
  • Syntax:
  • Elements, Locations,
  • Towards Semantics:
  • Cuts
  • Firedsets
slide-46
SLIDE 46

Sequence Diagrams

– 8 – 2017-06-01 – main –

23/45

slide-47
SLIDE 47

A Brief History of Sequence Diagrams

– 8 – 2017-06-01 – Ssd –

24/45

  • Message Sequence Charts,

ITU standardized in different versions (ITU Z.120, 1st edition: 1993); often accused of lacking a formal semantics.

msc event_ordering

proc_a proc_b proc_c m1

m2 m3 m4

(a) (ITU-T, 2011)

slide-48
SLIDE 48

A Brief History of Sequence Diagrams

– 8 – 2017-06-01 – Ssd –

24/45

  • Message Sequence Charts,

ITU standardized in different versions (ITU Z.120, 1st edition: 1993); often accused of lacking a formal semantics.

  • Sequence Diagrams of UML 1.x

(one of three main authors: I. Jacobson)

  • SDs of UML 2.x address some issues, yet the standard

exhibits unclarities and even contradictions (Harel and Maoz, 2007; Störrle, 2003)

msc event_ordering

proc_a proc_b proc_c m1

m2 m3 m4

(a) (ITU-T, 2011)

sd UserAccepted

:User :ACSystem Code d=duration CardOut {0..13} OK Unlock {d..3*d} t=now {t..t+3}

DurationConstraint TimeObservation TimeConstraint DurationObservation

(OMG, 2007)

slide-49
SLIDE 49

A Brief History of Sequence Diagrams

– 8 – 2017-06-01 – Ssd –

24/45

  • Message Sequence Charts,

ITU standardized in different versions (ITU Z.120, 1st edition: 1993); often accused of lacking a formal semantics.

  • Sequence Diagrams of UML 1.x

(one of three main authors: I. Jacobson)

  • SDs of UML 2.x address some issues, yet the standard

exhibits unclarities and even contradictions (Harel and Maoz, 2007; Störrle, 2003)

  • For the lecture, we consider

Live Sequence Charts (LSCs) (Damm and Harel, 2001; Klose, 2003; Harel and Marelly, 2003), LSCs have a common fragment with UML 2.x SDs: (Harel and Maoz, 2007).

msc event_ordering

proc_a proc_b proc_c m1

m2 m3 m4

(a) (ITU-T, 2011)

sd UserAccepted

:User :ACSystem Code d=duration CardOut {0..13} OK Unlock {d..3*d} t=now {t..t+3}

DurationConstraint TimeObservation TimeConstraint DurationObservation

(OMG, 2007)

LSC: L AM: invariant I: strict I1 I2 c1 I3 A B C D E c2 ∧ c3

slide-50
SLIDE 50

Live Sequence Charts: Syntax (Body)

– 8 – 2017-06-01 – main –

25/45

slide-51
SLIDE 51

LSC Body Building Blocks

– 8 – 2017-06-01 – Slscsyn –

26/45

slide-52
SLIDE 52

LSC Body Building Blocks

– 8 – 2017-06-01 – Slscsyn –

26/45

I1 I2 I3

slide-53
SLIDE 53

LSC Body Building Blocks

– 8 – 2017-06-01 – Slscsyn –

26/45

I1 I2 I3

instance line head (hot) line segment (cold) line segment instance line/ life line

slide-54
SLIDE 54

LSC Body Building Blocks

– 8 – 2017-06-01 – Slscsyn –

26/45

I1 I2 I3 A B C D E

instance line head (hot) line segment (cold) line segment instance line/ life line

slide-55
SLIDE 55

LSC Body Building Blocks

– 8 – 2017-06-01 – Slscsyn –

26/45

I1 I2 I3 A B C D E

instance line head (hot) line segment (cold) line segment instance line/ life line (hot) instantaneous message (hot) asynchronous message simultaneous region

slide-56
SLIDE 56

LSC Body Building Blocks

– 8 – 2017-06-01 – Slscsyn –

26/45

I1 I2 c1 I3 A B C D E c2 ∧ c3 c4

instance line head (hot) line segment (cold) line segment instance line/ life line (hot) instantaneous message (hot) asynchronous message simultaneous region

slide-57
SLIDE 57

LSC Body Building Blocks

– 8 – 2017-06-01 – Slscsyn –

26/45

I1 I2 c1 I3 A B C D E c2 ∧ c3 c4

instance line head (hot) line segment (cold) line segment instance line/ life line (hot) instantaneous message (hot) asynchronous message simultaneous region (cold) local invariant (hot) condition exclusive inclusive

slide-58
SLIDE 58

LSC Body Building Blocks

– 8 – 2017-06-01 – Slscsyn –

26/45

I1 I2 c1 I3 A B C D E c2 ∧ c3 c4

instance line head (hot) line segment (cold) line segment instance line/ life line (hot) instantaneous message (hot) asynchronous message simultaneous region (cold) local invariant (hot) condition exclusive inclusive

slide-59
SLIDE 59

LSC Body Building Blocks

– 8 – 2017-06-01 – Slscsyn –

26/45

I1 I2 c1 I3 A B C D E c2 ∧ c3 c4

instance line head (hot) line segment (cold) line segment instance line/ life line (hot) instantaneous message (hot) asynchronous message simultaneous region (cold) local invariant (hot) condition exclusive inclusive coregion

slide-60
SLIDE 60

The Plan: A Formal Semantics for a Visual Formalism

– 8 – 2017-06-01 – Slscsyn –

27/45

I1 I2

φ

I3

E F G

concrete syntax

(diagram)

((L, , ∼), I, Msg, Cond, LocInv, Θ) abstract syntax

q1 q2 q3 q4 q5 q6 q7 true

semantics

(Büchi automaton)

slide-61
SLIDE 61

LSC Body: Abstract Syntax

– 8 – 2017-06-01 – Slscsyn –

28/45

  • Definition. [LSC Body]

Let E be a set of events and C a set of atomic propositions, E ∩ C = ∅. An LSC body over E and C is a tuple ((L, , ∼), I, Msg, Cond, LocInv, Θ) where

  • L is a finite, non-empty of locations with
  • a partial order ⊆ L × L,
  • a symmetric simultaneity relation ∼ ⊆ L × L disjoint with , i.e. ∩ ∼ = ∅,
  • I = {I1, . . . , In} is a partitioning of L; elements of I are called instance line,
  • Msg ⊆ L × E × L is a set of messages with (l, E, l′) ∈ Msg only if (l, l′) ∈ ≺ ∪ ∼;

message (l, E, l′) is called instantaneous iff l ∼ l′ and asynchronous otherwise,

  • Cond ⊆ (2L \ ∅) × Φ(C) is a set of conditions

with (L, φ) ∈ Cond only if l ∼ l′ for all l = l′ ∈ L,

  • LocInv ⊆ L × {◦, •} × Φ(C) × L × {◦, •} is a set of local invariants

with (l, ι, φ, l′, ι′) ∈ LocInv only if l ≺ l′, ◦: exclusive, •: inclusive,

  • Θ : L ∪ Msg ∪ Cond ∪ LocInv → {hot, cold}

assigns to each location and each element a temperature.

slide-62
SLIDE 62

From Concrete to Abstract Syntax

– 8 – 2017-06-01 – Slscsyn –

29/45

  • locations L,
  • ⊆ L × L,

∼ ⊆ L × L

  • I = {I1, . . . , In},
  • Msg ⊆ L × E × L,
  • Cond ⊆ (2L \ ∅) × Φ(C)
  • LocInv ⊆ L × {◦, •} × Φ(C) × L × {◦, •},
  • Θ : L ∪ Msg ∪ Cond ∪ LocInv → {hot, cold}.

I1 I2 c1 I3 A B C D E c2 ∧ c3 c4

slide-63
SLIDE 63

From Concrete to Abstract Syntax

– 8 – 2017-06-01 – Slscsyn –

29/45

  • locations L,
  • ⊆ L × L,

∼ ⊆ L × L

  • I = {I1, . . . , In},
  • Msg ⊆ L × E × L,
  • Cond ⊆ (2L \ ∅) × Φ(C)
  • LocInv ⊆ L × {◦, •} × Φ(C) × L × {◦, •},
  • Θ : L ∪ Msg ∪ Cond ∪ LocInv → {hot, cold}.

I1 I2 c1 I3 A B C D E c2 ∧ c3 c4 l1,0 l1,1 l1,2 l1,3 l1,4 l2,0 l2,1 l2,2 l2,3 l3,0 l3,1 l3,2 l3,3

  • L = {l1,0, l1,1, l1,2, l1,3, l1,2, l1,4, l2,0, l2,1, l2,2, l2,3, l3,0, l3,1, l3,2, l3,3}
slide-64
SLIDE 64

LSC Body: Abstract Syntax

– 8 – 2017-06-01 – Slscsyn –

30/45

  • Definition. [LSC Body]

Let E be a set of events and C a set of atomic propositions, E ∩ C = ∅. An LSC body over E and C is a tuple ((L, , ∼), I, Msg, Cond, LocInv, Θ) where

  • L is a finite, non-empty of locations with
  • a partial order ⊆ L × L,
  • a symmetric simultaneity relation ∼ ⊆ L × L disjoint with , i.e. ∩ ∼ = ∅,
  • I = {I1, . . . , In} is a partitioning of L; elements of I are called instance line,
  • Msg ⊆ L × E × L is a set of messages with (l, E, l′) ∈ Msg only if (l, l′) ∈ ≺ ∪ ∼;

message (l, E, l′) is called instantaneous iff l ∼ l′ and asynchronous otherwise,

  • Cond ⊆ (2L \ ∅) × Φ(C) is a set of conditions

with (L, φ) ∈ Cond only if l ∼ l′ for all l = l′ ∈ L,

  • LocInv ⊆ L × {◦, •} × Φ(C) × L × {◦, •} is a set of local invariants

with (l, ι, φ, l′, ι′) ∈ LocInv only if l ≺ l′, ◦: exclusive, •: inclusive,

  • Θ : L ∪ Msg ∪ Cond ∪ LocInv → {hot, cold}

assigns to each location and each element a temperature.

slide-65
SLIDE 65

From Concrete to Abstract Syntax

– 8 – 2017-06-01 – Slscsyn –

31/45

  • locations L,
  • ⊆ L × L,

∼ ⊆ L × L

  • I = {I1, . . . , In},
  • Msg ⊆ L × E × L,
  • Cond ⊆ (2L \ ∅) × Φ(C)
  • LocInv ⊆ L × {◦, •} × Φ(C) × L × {◦, •},
  • Θ : L ∪ Msg ∪ Cond ∪ LocInv → {hot, cold}.

I1 I2 c1 I3 A B C D E c2 ∧ c3 c4 l1,0 l1,1 l1,2 l1,3 l1,4 l2,0 l2,1 l2,2 l2,3 l3,0 l3,1 l3,2 l3,3

  • L = {l1,0, l1,1, l1,2, l1,3, l1,2, l1,4, l2,0, l2,1, l2,2, l2,3, l3,0, l3,1, l3,2, l3,3}
slide-66
SLIDE 66

From Concrete to Abstract Syntax

– 8 – 2017-06-01 – Slscsyn –

31/45

  • locations L,
  • ⊆ L × L,

∼ ⊆ L × L

  • I = {I1, . . . , In},
  • Msg ⊆ L × E × L,
  • Cond ⊆ (2L \ ∅) × Φ(C)
  • LocInv ⊆ L × {◦, •} × Φ(C) × L × {◦, •},
  • Θ : L ∪ Msg ∪ Cond ∪ LocInv → {hot, cold}.

I1 I2 c1 I3 A B C D E c2 ∧ c3 c4 l1,0 l1,1 l1,2 l1,3 l1,4 l2,0 l2,1 l2,2 l2,3 l3,0 l3,1 l3,2 l3,3

  • L = {l1,0, l1,1, l1,2, l1,3, l1,2, l1,4, l2,0, l2,1, l2,2, l2,3, l3,0, l3,1, l3,2, l3,3}
  • l1,0 ≺ l1,1 ≺ l1,2 ≺ l1,3,

l1,2 ≺ l1,4, l2,0 ≺ l2,1 ≺ l2,2 ≺ l2,3, l3,0 ≺ l3,1 ≺ l3,2 ≺ l3,3, l1,1 ≺ l2,1, l2,2 ≺ l1,2, l2,3 ≺ l1,3, l3,2 ≺ l1,4, l2,1 ∼ l3,1, l2,2 ∼ l3,2,

slide-67
SLIDE 67

From Concrete to Abstract Syntax

– 8 – 2017-06-01 – Slscsyn –

31/45

  • locations L,
  • ⊆ L × L,

∼ ⊆ L × L

  • I = {I1, . . . , In},
  • Msg ⊆ L × E × L,
  • Cond ⊆ (2L \ ∅) × Φ(C)
  • LocInv ⊆ L × {◦, •} × Φ(C) × L × {◦, •},
  • Θ : L ∪ Msg ∪ Cond ∪ LocInv → {hot, cold}.

I1 I2 c1 I3 A B C D E c2 ∧ c3 c4 l1,0 l1,1 l1,2 l1,3 l1,4 l2,0 l2,1 l2,2 l2,3 l3,0 l3,1 l3,2 l3,3

  • L = {l1,0, l1,1, l1,2, l1,3, l1,2, l1,4, l2,0, l2,1, l2,2, l2,3, l3,0, l3,1, l3,2, l3,3}
  • l1,0 ≺ l1,1 ≺ l1,2 ≺ l1,3,

l1,2 ≺ l1,4, l2,0 ≺ l2,1 ≺ l2,2 ≺ l2,3, l3,0 ≺ l3,1 ≺ l3,2 ≺ l3,3, l1,1 ≺ l2,1, l2,2 ≺ l1,2, l2,3 ≺ l1,3, l3,2 ≺ l1,4, l2,1 ∼ l3,1, l2,2 ∼ l3,2,

  • I = {{l1,0, l1,1, l1,2, l1,3, l1,4}, {l2,0, l2,1, l2,2, l2,3}, {l3,0, l3,1, l3,2}},
slide-68
SLIDE 68

From Concrete to Abstract Syntax

– 8 – 2017-06-01 – Slscsyn –

31/45

  • locations L,
  • ⊆ L × L,

∼ ⊆ L × L

  • I = {I1, . . . , In},
  • Msg ⊆ L × E × L,
  • Cond ⊆ (2L \ ∅) × Φ(C)
  • LocInv ⊆ L × {◦, •} × Φ(C) × L × {◦, •},
  • Θ : L ∪ Msg ∪ Cond ∪ LocInv → {hot, cold}.

I1 I2 c1 I3 A B C D E c2 ∧ c3 c4 l1,0 l1,1 l1,2 l1,3 l1,4 l2,0 l2,1 l2,2 l2,3 l3,0 l3,1 l3,2 l3,3

  • L = {l1,0, l1,1, l1,2, l1,3, l1,2, l1,4, l2,0, l2,1, l2,2, l2,3, l3,0, l3,1, l3,2, l3,3}
  • l1,0 ≺ l1,1 ≺ l1,2 ≺ l1,3,

l1,2 ≺ l1,4, l2,0 ≺ l2,1 ≺ l2,2 ≺ l2,3, l3,0 ≺ l3,1 ≺ l3,2 ≺ l3,3, l1,1 ≺ l2,1, l2,2 ≺ l1,2, l2,3 ≺ l1,3, l3,2 ≺ l1,4, l2,1 ∼ l3,1, l2,2 ∼ l3,2,

  • I = {{l1,0, l1,1, l1,2, l1,3, l1,4}, {l2,0, l2,1, l2,2, l2,3}, {l3,0, l3,1, l3,2}},
  • Msg = {(l1,1, A, l2,1), (l2,2, B, l1,2), (l2,2, C, l3,2), (l2,3, D, l1,3), (l3,3, E, l1,4)}
slide-69
SLIDE 69

From Concrete to Abstract Syntax

– 8 – 2017-06-01 – Slscsyn –

31/45

  • locations L,
  • ⊆ L × L,

∼ ⊆ L × L

  • I = {I1, . . . , In},
  • Msg ⊆ L × E × L,
  • Cond ⊆ (2L \ ∅) × Φ(C)
  • LocInv ⊆ L × {◦, •} × Φ(C) × L × {◦, •},
  • Θ : L ∪ Msg ∪ Cond ∪ LocInv → {hot, cold}.

I1 I2 c1 I3 A B C D E c2 ∧ c3 c4 l1,0 l1,1 l1,2 l1,3 l1,4 l2,0 l2,1 l2,2 l2,3 l3,0 l3,1 l3,2 l3,3

  • L = {l1,0, l1,1, l1,2, l1,3, l1,2, l1,4, l2,0, l2,1, l2,2, l2,3, l3,0, l3,1, l3,2, l3,3}
  • l1,0 ≺ l1,1 ≺ l1,2 ≺ l1,3,

l1,2 ≺ l1,4, l2,0 ≺ l2,1 ≺ l2,2 ≺ l2,3, l3,0 ≺ l3,1 ≺ l3,2 ≺ l3,3, l1,1 ≺ l2,1, l2,2 ≺ l1,2, l2,3 ≺ l1,3, l3,2 ≺ l1,4, l2,1 ∼ l3,1, l2,2 ∼ l3,2,

  • I = {{l1,0, l1,1, l1,2, l1,3, l1,4}, {l2,0, l2,1, l2,2, l2,3}, {l3,0, l3,1, l3,2}},
  • Msg = {(l1,1, A, l2,1), (l2,2, B, l1,2), (l2,2, C, l3,2), (l2,3, D, l1,3), (l3,3, E, l1,4)}
  • Cond = {({l2,1, l3,1}, c4), ({l2,2}, c2 ∧ c3)},
slide-70
SLIDE 70

From Concrete to Abstract Syntax

– 8 – 2017-06-01 – Slscsyn –

31/45

  • locations L,
  • ⊆ L × L,

∼ ⊆ L × L

  • I = {I1, . . . , In},
  • Msg ⊆ L × E × L,
  • Cond ⊆ (2L \ ∅) × Φ(C)
  • LocInv ⊆ L × {◦, •} × Φ(C) × L × {◦, •},
  • Θ : L ∪ Msg ∪ Cond ∪ LocInv → {hot, cold}.

I1 I2 c1 I3 A B C D E c2 ∧ c3 c4 l1,0 l1,1 l1,2 l1,3 l1,4 l2,0 l2,1 l2,2 l2,3 l3,0 l3,1 l3,2 l3,3

  • L = {l1,0, l1,1, l1,2, l1,3, l1,2, l1,4, l2,0, l2,1, l2,2, l2,3, l3,0, l3,1, l3,2, l3,3}
  • l1,0 ≺ l1,1 ≺ l1,2 ≺ l1,3,

l1,2 ≺ l1,4, l2,0 ≺ l2,1 ≺ l2,2 ≺ l2,3, l3,0 ≺ l3,1 ≺ l3,2 ≺ l3,3, l1,1 ≺ l2,1, l2,2 ≺ l1,2, l2,3 ≺ l1,3, l3,2 ≺ l1,4, l2,1 ∼ l3,1, l2,2 ∼ l3,2,

  • I = {{l1,0, l1,1, l1,2, l1,3, l1,4}, {l2,0, l2,1, l2,2, l2,3}, {l3,0, l3,1, l3,2}},
  • Msg = {(l1,1, A, l2,1), (l2,2, B, l1,2), (l2,2, C, l3,2), (l2,3, D, l1,3), (l3,3, E, l1,4)}
  • Cond = {({l2,1, l3,1}, c4), ({l2,2}, c2 ∧ c3)},
  • LocInv = {(l1,1, ◦, c1, l1,2, •)}
slide-71
SLIDE 71

Well-Formedness

– 8 – 2017-06-01 – Slscsyn –

32/45

Bondedness/no floating conditions: (could be relaxed a little if we wanted to)

  • For each location l ∈ L, if l is the location of
  • a condition, i.e. ∃ (L, φ) ∈ Cond : l ∈ L, or
  • a local invariant, i.e. ∃ (l1, ι1, φ, l2, ι2) ∈ LocInv : l ∈ {l1, l2},

then there is a location l′ simultaneous to l, i.e. l ∼ l′, which is the location of

  • an instance head, i.e. l′ is minimal wrt. , or
  • a message, i.e.

∃ (l1, E, l2) ∈ Msg : l ∈ {l1, l2}. Note: if messages in a chart are cyclic, then there doesn’t exist a partial order (so such diagrams don’t even have an abstract syntax).

slide-72
SLIDE 72

Concrete vs. Abstract Syntax

– 8 – 2017-06-01 – Slscsyn –

33/45

I1 I2 c1 I3 A B C D E c2 ∧ c3 c4 I1 I2 c1 I3 A B C D E c2 ∧ c3 c4 I1 I2 c1 I3 A B C D E c2 ∧ c3 c4 I3 I2 c1 I1 A B C D E c2 ∧ c3 c4

slide-73
SLIDE 73

Concrete vs. Abstract Syntax

– 8 – 2017-06-01 – Slscsyn –

33/45

I1 I2 c1 I3 A B C D E c2 ∧ c3 c4 I1 I2 c1 I3 A B C D E c2 ∧ c3 c4 I1 I2 c1 I3 A B C D E c2 ∧ c3 c4 I3 I2 c1 I1 A B C D E c2 ∧ c3 c4

  • L = {l1,0, l1,1, l1,2, l1,3, l1,2, l1,4, l2,0, l2,1, l2,2, l2,3, l3,0, l3,1, l3,2, l3,3}
  • l1,0 ≺ l1,1 ≺ l1,2 ≺ l1,3,

l1,2 ≺ l1,4, l2,0 ≺ l2,1 ≺ l2,2 ≺ l2,3, l3,0 ≺ l3,1 ≺ l3,2 ≺ l3,3, l1,1 ≺ l2,1, l2,2 ≺ l1,2, l2,3 ≺ l1,3, l3,2 ≺ l1,4, l2,1 ∼ l3,1, l2,2 ∼ l3,2,

  • I = {{l1,0, l1,1, l1,2, l1,3, l1,4}, {l2,0, l2,1, l2,2, l2,3}, {l3,0, l3,1, l3,2}},
  • Msg = {(l1,1, A, l2,1), (l2,2, B, l1,2), (l2,2, C, l3,2), (l2,3, D, l1,3), (l3,3, E, l1,4)}
  • Cond = {({l2,1, l3,1}, c4), ({l2,2}, c2 ∧ c3)},
  • LocInv = {(l1,1, ◦, c1, l1,2, •)}
slide-74
SLIDE 74

Content

– 8 – 2017-06-01 – Scontent –

34/45

  • User Stories
  • Use Cases
  • Use Case Diagrams
  • Sequence Diagrams
  • A Brief History
  • Live Sequence Charts
  • Syntax:
  • Elements, Locations,
  • Towards Semantics:
  • Cuts
  • Firedsets
slide-75
SLIDE 75

LSC Semantics: Towards Automaton Construction

– 8 – 2017-06-01 – main –

35/45

slide-76
SLIDE 76

The Plan: A Formal Semantics for a Visual Formalism

– 8 – 2017-06-01 – Scutfire –

36/45

I1 I2

φ

I3

E F G

concrete syntax

(diagram)

((L, , ∼), I, Msg, Cond, LocInv, Θ) abstract syntax

q1 q2 q3 q4 q5 q6 q7 true

semantics

(Büchi automaton)

slide-77
SLIDE 77

LSC Semantics: It’s in the Cuts!

– 8 – 2017-06-01 – Scutfire –

37/45

slide-78
SLIDE 78

LSC Semantics: It’s in the Cuts!

– 8 – 2017-06-01 – Scutfire –

37/45

  • Definition. Let ((L, , ∼), I, Msg, Cond, LocInv, Θ) be an LSC body.

A non-empty set ∅ = C ⊆ L is called a cut of the LSC body iff C

  • is downward closed, i.e.

∀ l, l′ ∈ L • l′ ∈ C ∧ l l′ = ⇒ l ∈ C,

  • is closed under simultaneity, i.e.

∀ l, l′ ∈ L • l′ ∈ C ∧ l ∼ l′ = ⇒ l ∈ C, and

  • comprises at least one location per instance line, i.e.

∀ I ∈ I • C ∩ I = ∅.

slide-79
SLIDE 79

LSC Semantics: It’s in the Cuts!

– 8 – 2017-06-01 – Scutfire –

37/45

  • Definition. Let ((L, , ∼), I, Msg, Cond, LocInv, Θ) be an LSC body.

A non-empty set ∅ = C ⊆ L is called a cut of the LSC body iff C

  • is downward closed, i.e.

∀ l, l′ ∈ L • l′ ∈ C ∧ l l′ = ⇒ l ∈ C,

  • is closed under simultaneity, i.e.

∀ l, l′ ∈ L • l′ ∈ C ∧ l ∼ l′ = ⇒ l ∈ C, and

  • comprises at least one location per instance line, i.e.

∀ I ∈ I • C ∩ I = ∅.

The temperature function is extended to cuts as follows: Θ(C) =

  • hot

, if ∃ l ∈ C • (∄ l′ ∈ C • l ≺ l′) ∧ Θ(l) = hot cold , otherwise that is, C is hot if and only if at least one of its maximal elements is hot.

slide-80
SLIDE 80

Cut Examples

– 8 – 2017-06-01 – Scutfire –

38/45 ∅ = C ⊆ L — downward closed — simultaneity closed — at least one loc. per instance line

I1 I2

φ

I3

E F G

l1,0 l1,1 l1,2 l2,0 l2,1 l2,2 l2,3 l3,0 l3,1

slide-81
SLIDE 81

Cut Examples

– 8 – 2017-06-01 – Scutfire –

38/45 ∅ = C ⊆ L — downward closed — simultaneity closed — at least one loc. per instance line

I1 I2

φ

I3

E F G

l1,0 l1,1 l1,2 l2,0 l2,1 l2,2 l2,3 l3,0 l3,1

slide-82
SLIDE 82

Cut Examples

– 8 – 2017-06-01 – Scutfire –

38/45 ∅ = C ⊆ L — downward closed — simultaneity closed — at least one loc. per instance line

I1 I2

φ

I3

E F G

l1,0 l1,1 l1,2 l2,0 l2,1 l2,2 l2,3 l3,0 l3,1

slide-83
SLIDE 83

Cut Examples

– 8 – 2017-06-01 – Scutfire –

38/45 ∅ = C ⊆ L — downward closed — simultaneity closed — at least one loc. per instance line

I1 I2

φ

I3

E F G

l1,0 l1,1 l1,2 l2,0 l2,1 l2,2 l2,3 l3,0 l3,1

slide-84
SLIDE 84

Cut Examples

– 8 – 2017-06-01 – Scutfire –

38/45 ∅ = C ⊆ L — downward closed — simultaneity closed — at least one loc. per instance line

I1 I2

φ

I3

E F G

l1,0 l1,1 l1,2 l2,0 l2,1 l2,2 l2,3 l3,0 l3,1

slide-85
SLIDE 85

Cut Examples

– 8 – 2017-06-01 – Scutfire –

38/45 ∅ = C ⊆ L — downward closed — simultaneity closed — at least one loc. per instance line

I1 I2

φ

I3

E F G

l1,0 l1,1 l1,2 l2,0 l2,1 l2,2 l2,3 l3,0 l3,1

slide-86
SLIDE 86

Cut Examples

– 8 – 2017-06-01 – Scutfire –

38/45 ∅ = C ⊆ L — downward closed — simultaneity closed — at least one loc. per instance line

I1 I2

φ

I3

E F G

l1,0 l1,1 l1,2 l2,0 l2,1 l2,2 l2,3 l3,0 l3,1

slide-87
SLIDE 87

Cut Examples

– 8 – 2017-06-01 – Scutfire –

38/45 ∅ = C ⊆ L — downward closed — simultaneity closed — at least one loc. per instance line

I1 I2

φ

I3

E F G

l1,0 l1,1 l1,2 l2,0 l2,1 l2,2 l2,3 l3,0 l3,1

slide-88
SLIDE 88

A Successor Relation on Cuts

– 8 – 2017-06-01 – Scutfire –

39/45

The partial order “” and the simultaneity relation “∼” of locations induce a direct successor relation on cuts of an LSC body as follows: Definition. Let C ⊆ L bet a cut of LSC body ((L, , ∼), I, Msg, Cond, LocInv, Θ). A set ∅ = F ⊆ L of locations is called fired-set F of cut C if and only if

  • C ∩ F = ∅ and C ∪ F is a cut, i.e. F is closed under simultaneity,
  • all locations in F are direct ≺-successors of the front of C, i.e.

∀ l ∈ F ∃ l′ ∈ C • l′ ≺ l ∧ (∄ l′′ ∈ C • l′ ≺ l′′ ≺ l),

  • locations in F, that lie on the same instance line, are pairwise unordered, i.e.

∀ l = l′ ∈ F • (∃ I ∈ I • {l, l′} ⊆ I) = ⇒ l l′ ∧ l′ l,

  • for each asynchronous message reception in F,

the corresponding sending is already in C, ∀ (l, E, l′) ∈ Msg • l′ ∈ F = ⇒ l ∈ C. The cut C′ = C ∪ F is called direct successor of C via F, denoted by C F C′.

slide-89
SLIDE 89

Successor Cut Example

– 8 – 2017-06-01 – Scutfire –

40/45

C ∩ F = ∅ — C ∪ F is a cut — only direct ≺-successors — same instance line on front pairwise unordered — sending of asynchronous reception already in

I1 I2

φ

I3

E F G

l1,0 l1,1 l1,2 l2,0 l2,1 l2,2 l2,3 l3,0 l3,1

slide-90
SLIDE 90

Successor Cut Example

– 8 – 2017-06-01 – Scutfire –

40/45

C ∩ F = ∅ — C ∪ F is a cut — only direct ≺-successors — same instance line on front pairwise unordered — sending of asynchronous reception already in

I1 I2

φ

I3

E F G

l1,0 l1,1 l1,2 l2,0 l2,1 l2,2 l2,3 l3,0 l3,1

slide-91
SLIDE 91

Language of LSC Body: Example

– 8 – 2017-06-01 – Scutfire –

41/45

I1 I2

φ

I3

E F G

l1,0 l1,1 l1,2 l2,0 l2,1 l2,2 l2,3 l3,0 l3,1

q1 q2 q3 q4 q5 q6 q7

¬E! E! ¬E? E? ∧ φ F! F! ¬(F? ∨ G! ∨ G?) G! ∧ G? ∧ ¬F? F? ∧ ¬(G! ∧ G?) ¬F? F? ¬(G! ∧ G?) G! ∧ G? G! ∧ G? ∧ F? true E? ∧ ¬φ

The TBA B(L ) of LSC L over C and E is (CB, Q, qini, →, QF ) with

  • CB = C ˙

∪ E!?, where E!? = {E!, E? | E ∈ E},

  • Q is the set of cuts of L , qini is the instance heads cut,
  • → consists of loops, progress transitions (from F), and legal exits (cold cond./local inv.),
  • QF = {C ∈ Q | Θ(C) = cold ∨ C = L} is the set of cold cuts and the maximal cut.
slide-92
SLIDE 92

TBA Construction Principle

– 8 – 2017-06-01 – Scutfire –

42/45 Recall: The TBA B(L ) of LSC L is (C, Q, qini, →, QF ) with

  • Q is the set of cuts of L , qini is the instance heads cut,
  • CB = C ˙

∪ E!?,

  • → consists of loops, progress transitions (from F ), and legal exits (cold cond./local inv.),
  • F = {C ∈ Q | Θ(C) = cold ∨ C = L} is the set of cold cuts.
slide-93
SLIDE 93

TBA Construction Principle

– 8 – 2017-06-01 – Scutfire –

42/45 Recall: The TBA B(L ) of LSC L is (C, Q, qini, →, QF ) with

  • Q is the set of cuts of L , qini is the instance heads cut,
  • CB = C ˙

∪ E!?,

  • → consists of loops, progress transitions (from F ), and legal exits (cold cond./local inv.),
  • F = {C ∈ Q | Θ(C) = cold ∨ C = L} is the set of cold cuts.

So in the following, we “only” need to construct the transitions’ labels:

→= {(q, , q) | q ∈ Q} ∪ {(q, , q′) | q F q′} ∪ {(q, , L) | q ∈ Q}

slide-94
SLIDE 94

TBA Construction Principle

– 8 – 2017-06-01 – Scutfire –

42/45 Recall: The TBA B(L ) of LSC L is (C, Q, qini, →, QF ) with

  • Q is the set of cuts of L , qini is the instance heads cut,
  • CB = C ˙

∪ E!?,

  • → consists of loops, progress transitions (from F ), and legal exits (cold cond./local inv.),
  • F = {C ∈ Q | Θ(C) = cold ∨ C = L} is the set of cold cuts.

So in the following, we “only” need to construct the transitions’ labels:

→= {(q, ψloop(q), q) | q ∈ Q} ∪ {(q, ψprog(q, q′), q′) | q F q′} ∪ {(q, ψexit(q), L) | q ∈ Q}

slide-95
SLIDE 95

TBA Construction Principle

– 8 – 2017-06-01 – Scutfire –

42/45 Recall: The TBA B(L ) of LSC L is (C, Q, qini, →, QF ) with

  • Q is the set of cuts of L , qini is the instance heads cut,
  • CB = C ˙

∪ E!?,

  • → consists of loops, progress transitions (from F ), and legal exits (cold cond./local inv.),
  • F = {C ∈ Q | Θ(C) = cold ∨ C = L} is the set of cold cuts.

So in the following, we “only” need to construct the transitions’ labels:

→= {(q, ψloop(q), q) | q ∈ Q} ∪ {(q, ψprog(q, q′), q′) | q F q′} ∪ {(q, ψexit(q), L) | q ∈ Q}

q ...

ψloop(q): “what allows us to stay at cut q” “. . . F1” ψprog(q, q′): “characterisation of firedset Fn” ψexit(q): “what allows us to legally exit” true

I1 I2 c1 I3 A B C D E c2 ∧ c3

slide-96
SLIDE 96

Tell Them What You’ve Told Them. . .

– 8 – 2017-06-01 – Sttwytt –

43/45

  • User Stories: simple example of scenarios
  • strong point: naming tests is necessary,
  • weak point: hard to keep overview; global restrictions.
  • Use-Cases:
  • interactions between system and actors,
  • be sure to elaborate exceptions and corner cases,
  • in particular effective with customers lacking technical background.
  • Use-Case Diagrams:
  • visualise which participants are relevant for which use-case,
  • are rather useless without the underlying use-case.
  • Sequence Diagrams:
  • a visual formalism for interactions, i.e.,
  • precisely defined syntax,
  • precisely defined semantics (→ next lecture).
  • Can be used to precisely describe the interactions of a use-case.
slide-97
SLIDE 97

References

– 8 – 2017-06-01 – main –

44/45

slide-98
SLIDE 98

References

– 8 – 2017-06-01 – main –

45/45 Balzert, H. (2009). Lehrbuch der Softwaretechnik: Basiskonzepte und Requirements Engineering. Spektrum, 3rd edition. Beck, K. (1999). Extreme Programming Explained – Embrace Change. Addison-Wesley. Damm, W. and Harel, D. (2001). LSCs: Breathing life into Message Sequence Charts. Formal Methods in System Design, 19(1):45–80. Harel, D. and Maoz, S. (2007). Assert and negate revisited: Modal semantics for UML sequence diagrams. Software and System Modeling (SoSyM). To appear. (Early version in SCESM’06, 2006, pp. 13-20). Harel, D. and Marelly, R. (2003). Come, Let’s Play: Scenario-Based Programming Using LSCs and the Play-Engine. Springer-Verlag. ITU-T (2011). ITU-T Recommendation Z.120: Message Sequence Chart (MSC), 5 edition. Jacobson, I. (1992). Object Oriented Software Engineering – A Use Case Driven Approach. ACM Press. Klose, J. (2003). LSCs: A Graphical Formalism for the Specification of Communication Behavior. PhD thesis, Carl von Ossietzky Universität Oldenburg. Ludewig, J. and Lichter, H. (2013). Software Engineering. dpunkt.verlag, 3. edition. OMG (2007). Unified modeling language: Superstructure, version 2.1.2. Technical Report formal/07-11-02. Störrle, H. (2003). Assert, negate and refinement in UML-2 interactions. Technical Report TUM-I0323, Technische Universität München.