certain times. There are other ways to
forbid things from occurring; one of
which is done by indicating that events
in the main chart must occur only in
the specified (partial) order. For example, one can specify that when the
main chart is active, events that appear
in the chart but are not presently enabled cannot be triggered at that point
in time by other charts.
A modest view of LSC considers it
to be a requirements and specification
language for making assertions about
sequences of events. In this view, a system satisfies an LSC specification if all
its runs satisfy all the universal charts
in the specification, and for each existential chart, there is at least one run
that satisfies it.
However, the play-out technique facilitates the execution of an LSC specification, that is, a collection of charts,
just like any computer program. Play-out does this by tracking events that
may be selected next in all lifelines
in all charts, selecting and triggering
events subject to the must/may/forbid-den modalities, and advancing affected charts accordingly. 21 As described
in more detail below, play-out may
be viewed as interpreting charts with
modal events as threads of behavior
with their requested, waited-for, and
blocked events.
A dialect of LSC has been designed
to be compliant with UML 2.0, 22 and
can be defined as a profile therein.
Instead of precharts it uses solid and
dashed arrows to indicate whether an
event is to be executed or is only moni-
tored, while the red and blue color
retain their respective modalities of
must and may. The PlayGo tool18, 23 is
currently based on this version of the
language. Figure 6 depicts a PlayGo
example similar to the water-tap appli-
cation discussed earlier, with the addi-
tion of the user pressing a start button
to activate all scenarios.
This process is often referred to
as naïve play-out. In a more advanced
mechanism, called smart play-out19, 29
the Play-Engine uses either model-checking or AI planning algorithms
to look ahead, in an attempt to select
events in ways that do not eventually
lead to violation of the specification
or deadlock.
In addition to the interpreter-like
approach of play-out, a compiler for
LSC has been developed, which produces executable code by compiling
the specification into Java and weaving
the results with AspectJ. 38
One notable difference between LSC
and the BPJ package is that BPJ benefits
from the power of the Java host language. By contrast, the LSC language
provides its own constructs for objects
and properties, flow of control, exceptions, variables, symbolic objects and
messages, a notion of time, sub-chart
scope, access to functions in other languages, and external communication. 21
Play-in. An essential element of
programming is the process by which
programmers perform actual coding.
In behavioral programming, it seems
only natural to allow this activity to
include walking through a scenario,
generating events and sequences
thereof, and using them in specifying
what we want done or forbidden. Toward that purpose, the LSC language
allows a new way of coding, called
play-in, 15, 21 which captures scenarios
as follows: whenever possible, the developer actually performs the event—
Figure 6. umL-compliant LsCs. each chart begins with the user pressing the start button. two charts request tap-turning events, and the
third causes their interleaving by alternately waiting for these events. events can occur only when enabled for triggering in all charts in
which they appear. the s YnC construct forces order between events in different lifelines.
AddHotThreeTimes LSC
User
startButton hotWater
start()
SYNC
addHot()
addHot()
addHot()
AddColdThreeTimesLSC
User
startButton hotWater
start()
SYNC
addCold()
addCold()
addCold()
Interleave LSC
User
startButton hotWater coldWater
start()
addHot()
SYNC
loop
[– 1,– 1]
addCold()
SYNC