A novel paradigm for programming reactive
systems centered on naturally specified
BY DaViD haReL, assaF maRRon, anD GeRa Weiss
sPeLLing oUT The requirements for a software system
under development is not an easy task, and translating
captured requirements into correct operational software
can be even harder. Many technologies (languages,
modeling tools, programming paradigms) and
methodologies (agile, test-driven, model-driven) were
designed, among other things, to help address these
challenges. One widely accepted practice is to formalize
requirements in the form of use cases and scenarios.
Our work extends this approach into using scenarios
for actual programming. Specifically, we propose
scenario-coding techniques and design approaches for
constructing reactive systems28 incrementally from their
The work on behavioral programming began
with scenario-based programming, a way to create
executable specifications of reactive systems,
introduced through the language of live sequence
charts (LSC) and its Play-Engine implementation.
The initial purpose was to enable testing and refining
specifications and prototypes, and it was later
extended toward building actual systems. To this end,
the underlying behavioral principles have also been
implemented in Java via the BPJ package25 and in
26, 34, 42, 43 adding a programming
point of view to that of requirement specification.
To illustrate the naturalness of constructing systems by composing behaviors, consider how children may be
taught, step-by-step, to play strategy
games (See Gordon et al.
14). For example, in teaching the game of Tic-Tac-Toe, we first describe rules of the game,
Enforce Turns: To play, one player
marks a square in a 3 by 3 grid with X,
then the other player marks a square
with O, then X plays again, and so on;
SquareTaken: Once a square is
marked, it cannot be marked again;
a player places three of his or her marks
in a horizontal, vertical, or diagonal
line, the player wins;
Now we may already start playing.
Later, the child may infer, or the teacher may suggest, some tactics:
Add ThirdO: After placing two Os in
a line, the O player should try to mark
the third square (to win the game);
Prevent ThirdX: After the X player
marks two squares in a line, the O player should try to mark the third square
(to foil the attack); and
DefaultOMoves: When other tactics are not applicable, player O should
prefer the center square, then the cor-
Behavioral programming is a novel,
language-independent paradigm for
programming reactive systems, centered
on natural and incremental specification
of behavior, and implemented in the visual
formalism of live sequence charts (LsC),
and in the BPJ Java package.
the approach allows coding
applications as multi-modal scenarios,
each corresponding to an individual
requirement, specifying what can, must,
or may not happen following certain
sequences of events.
to facilitate full behavioral modularity
via the independent coding of separate
facets of behavior, all scenarios run
simultaneously, and all are consulted at
every decision point during execution.
the paradigm is supported by tools
for debugging, execution planning,
learning-based adaptivity, and
model-checking for early detection of
conflicting and incomplete requirements.