Modeling complex systems is a difficult and error-prone task. The emerging Scenario-Based Programming approach (SBP) [DaHa01, HaMa03, HaMaWeACM] aims to mitigate this difficulty. The key notion underlying SBP is modeling through the specification of scenarios, each of which represents a certain aspect of the system’s behavior. These scenarios may describe either desirable behaviors that the system should strive to uphold, or undesirable behaviors that the system should try to avoid. The models produced in SBP are fully executable: when composed together according to certain underlying semantics, the scenarios yield cohesive system behavior.
The SBP approach has been implemented in dedicated frameworks such as the Play-Engine and PlayGo for the visual language of Live Sequence Charts (LSC) language [HaMa03, Playgo2010] or ScenarioTools [GeGrGuKoGlMaKa17] for the Scenario Modeling Langauge (SML) textual language. Further, SBP has been implemented on top of several standard programming languages, such as Java [HaMaWe10BPJ], C++ [HaKa14], and JavsScript [BaWeRe18], and was amalgamated with the Statecharts visual formalism [morse2018SCSBP]
SBP has been successfully used in modeling complex systems, such as web-servers [HaKa14], cache coherence protocols [HaKaMaMa16], robotic controllers [GrGr18b], and as part of the Wise Computing effort aimed at turning computers into proactive members of system development teams [HaKaMaMa18IEEEComputer].
Despite the diversified adaptations of SBP for various programming languages and for various use cases, a common theme remains: in all existing frameworks, scenarios are interwoven using a very basic mechanism. Specifically, during execution the scenarios are synchronized at predetermined points, and at every synchronization point each scenario declares a set of events it would like to see triggered, and a set of events it forbids from being triggered. The execution framework then selects for triggering one event that is requested by at least one scenario and is not blocked by any of the scenarios. The event is broadcast to all scenarios, and the execution continues until the next synchronization point is reached. An example appears in Fig. LABEL:fig:watertap.