Logo BCDDLogo CSC
BCDDBehavioural Contract-Driven Design
version 1.0-beta
ITEN

Chapter 11 — One boundary or separate boundaries

In part one the staircase light has a single boundary, described by the CSC UsoLuce, in which the press of the button and the observed light appear together. This chapter divides that boundary in two, states when the division is appropriate and highlights the problem that results from it.

When a boundary is divided

A boundary is the interface at which what passes between a system and its consumer is observed (chapter 1). The press of the button is observed on the wall of the entrance hall, next to the button; the light is observed on the stairs, by looking at the lamp. Checking that the light switches off by itself does not require observing the button, and checking that a press is recognised does not require observing the light.

The criterion is the following: a boundary is divided in two when what passes through it is observed at two distinct points. The guarantees of each of the two new boundaries must also be checkable without observing the other. Elements observed at the same point remain in the same boundary: the cleaning request, the warning and the mode of the light all concern the light, and remain together.

The division is useful above all when the two boundaries are provided by different systems, implemented separately: whoever builds the button receives only the description of the button's boundary. This case is covered in chapter 13.

The two CSCs

The boundary of the press of the button is described by the CSC Pressione:

-- The staircase button, as seen by whoever presses it.

CSC Pressione VERSION 0.1
  STATUS HYPOTHESIS
  PURPOSE "The person on the stairs presses the button to ask for light"

  EVENT IN   premuto

  ASSUME    a1: VERBAL "Whoever presses the button holds it down for at least a tenth of a second"
                VERIFY BY JUDGEMENT "a person who observes how the button is pressed"
END

The boundary of the observed light is described by the CSC Luce:

-- The staircase light, as seen by the person on the stairs and by the caretaker.

CSC Luce VERSION 0.1
  STATUS HYPOTHESIS
  PURPOSE "The person on the stairs sees the light on for the time needed to go up or down"

  TYPE       Modo := {spenta, accesa, in_pulizia}

  CAPABILITY Pulizie(durata: Duration)
  EVENT OUT  avviso
  STATE      modo : Modo INITIAL spenta

  GUARANTEE g2: VERBAL "The light switches off by itself after a while"
                VERIFY BY JUDGEMENT "a person with a watch"
  GUARANTEE g3: VERBAL "Shortly before switching off, the light gives a warning to the person on the stairs"
                VERIFY BY JUDGEMENT "a person on the stairs who waits for the light to switch off"
  GUARANTEE g4: VERBAL "A cleaning request is rejected if the requested duration exceeds two hours; otherwise it is accepted"
                VERIFY BY JUDGEMENT "the caretaker, who requests cleaning with different durations"
  GUARANTEE g5: VERBAL "After an accepted request the light stays on for the whole requested duration; when it expires the request has succeeded"
                VERIFY BY JUDGEMENT "the caretaker, with a watch"
  GUARANTEE g6: VERBAL "If the light cannot stay on until the duration expires, the request has failed"
                VERIFY BY JUDGEMENT "the caretaker, who removes the lamp during cleaning"

  SCENARIO s4 EXPECT ADMITTED
    @0 s     requested(Pulizie)   VERBAL "the caretaker requests three hours of cleaning"
    @0 s     rejected(Pulizie)
END

The lines of UsoLuce 0.2 are distributed as follows:

Lines of UsoLuce 0.2 Where they go
EVENT IN premuto, the assumption a1 Pressione
TYPE Modo, CAPABILITY Pulizie, EVENT OUT avviso, STATE modo Luce
the guarantees g2, g3, g4, g5, g6 and the scenario s4 Luce
the guarantees g1, g2a, g2b, g7 and the scenarios s1, s2, s3 in neither of the two

The two CSCs are new: they have version 0.1 and the header STATUS HYPOTHESIS. The lines copied from UsoLuce do not carry their approval with them, because the division changes the contract and requires a new decision. Until the two CSCs are approved, UsoLuce 0.2, approved with decision D-12, remains in force.

The report

$ bcdd check --strict Pressione.csc
bcdd check --strict Pressione.csc
lines: 11 (recognised 7, comments 1, blank 3, unrecognised 0)
blocks: 1
  line 3: CSC Pressione VERSION 0.1, STATUS HYPOTHESIS

1. ERRORS: 0

2. DEGREE OF THE CONTRACTUAL LINES
  verbal: 1
  formal: 0
  declared extension: 0
  unrecognised: 0
  line 9: ASSUME a1 verbal

3. UNDECIDED: 0

4. PENDING APPROVAL, NOT CONTRACT: 1
  line 9: ASSUME a1

5. UNRECOGNISED LINES: 0

6. UNDECLARED TYPES: 0

7. CSCs NAMED BUT NOT CHECKED: 0

outcome: no errors
$ bcdd check --strict Luce.csc
bcdd check --strict Luce.csc
lines: 27 (recognised 21, comments 1, blank 5, unrecognised 0)
blocks: 1
  line 3: CSC Luce VERSION 0.1, STATUS HYPOTHESIS

1. ERRORS: 0
…
4. PENDING APPROVAL, NOT CONTRACT: 5
  line 13: GUARANTEE g2
  line 15: GUARANTEE g3
  line 17: GUARANTEE g4
  line 19: GUARANTEE g5
  line 21: GUARANTEE g6
…
outcome: no errors

Both CSCs pass the check. The CSC Pressione, however, contains an assumption on which no guarantee depends: the guarantee that depended on a1 was g1, which is no longer found in either of the two CSCs.

The problem: the guarantees that bind the two boundaries

The guarantee g1, “when someone presses the button, the light switches on”, names an element of each boundary: the press, which is in Pressione, and the light, which is in Luce. The same holds for g2a and g2b, which concern the time elapsed since the last press, for g7, which describes the effect of a press during cleaning, and for the scenarios s1, s2 and s3, in which both premuto and modo appear.

None of these lines can be written in either of the two CSCs. A CSC describes a single boundary and names only its own elements: in Luce the event premuto does not exist, and in Pressione the state modo does not exist. Writing g1 in Luce would violate the rule of chapter 1, according to which a guarantee concerns only what is observed at the boundary.

The guarantees that bind two boundaries are written in what lies behind both, the entity, described in chapter 12.

Summary

Special cases

Scenario with elements of two boundaries. If the scenario s1 of UsoLuce is added at the end of the CSC Luce, with the instant @0 s premuto modo = accesa at line 28, the report shows:

1. ERRORS: 1
  line 28: [E03] name not declared as EVENT: premuto

Name preceded by the name of the CSC. If Pressione.premuto is written in the same line, the report shows a different error:

1. ERRORS: 1
  line 28: [E20] Pressione.premuto: in a CSC, names are not written with the connector in front. The order of two connectors is written in a SCENARIO of the entity

In its messages bcdd calls a CSC cited by an entity a “connector”; the manual uses “boundary” (chapter 12). The message refers to the form described in chapter 18.

Verbal guarantee that names the other boundary. If the guarantee g1 is copied into Luce unchanged, bcdd reports nothing: it does not interpret the text between quotation marks and does not recognise that the guarantee refers to the press. The assessment is the responsibility of whoever writes the CSC.