Our contribution is not limited to mere code gen-
eration, but also includes modules for real-time de-
bugging, simulation and visual monitoring that, in our
opinion, make BlueState a real improvement over the
current solutions.
In the following section, we analyse the main code
generation techniques for state machines, thus justi-
fying our choice of the class metamodel as the base
technique. In section 3 a description of BlueState and
its usage context is carried out. Section 4 includes
a study of tools similar to BlueState that we use to
vouch for its quality. Finally we draw some conclu-
sions and explain our current and future lines of work.
2 IMPLEMENTATION
TECHNIQUES
There are diverse implementation techniques and de-
sign patterns that are aimed at translating the behav-
ior defined in UML state machine diagrams into code.
We will now analyse such techniques.
Traditional techniques are transition ta-
bles (Cargill, 1992), conditional statements (Dou-
glass, 1998) and the state design pattern (Gamma,
1995). These techniques are aimed at implementing
basic state diagrams and do not directly contemplate
important characteristics of the UML state diagrams,
such as composite states, guards, history states,
“doActivity” behaviors, choices, call events, etc.
Some works have sought to extend these tech-
niques or have created alternative models to solve
these problems and getting closer to the UML spec-
ification. For instance, in (Niaz and Tanaka, 2005)
the state pattern is extended to allow for more ele-
ments, such as composite states. In (Douglass, 1998;
Harel and Gery, 1997) more characteristics are added
to the conditional statements method. The transition
tables method is also used in (Kohler et al., 2000).
Other works (Samek and Montgomery, 2000; Pint´er
and Majzik, 2003) employ hierarchical models to deal
with composite states and other features. Several of
these models utilize non intuitive structures that do
not comply with the UML object-oriented approach,
which makes their understanding and extension com-
plicated.
Nevertheless, the class metamodel technique used
in this work solves these inconveniences, making the
implementation of the state machine diagram a natu-
ral process according to the UML specification.
The class metamodel technique for state dia-
grams (Knapp and Merz, 2002; Derezi´nska and Pil-
itowski, 2009; Mocek, 2010; North State Software,
2008) is an implementation technique less extended
than previously mentioned ones, but very powerful
and closer to the object-oriented paradigm.
Some works (Jakimi and Elkoutbi, 2009; Sterkin,
2008) explain that the syntax of object-oriented lan-
guages such as Java or C# does not allow us to es-
tablish a one-to-one mapping between concepts of
the state diagrams and language features. Therefore,
they indicate that it is necessary to use more com-
plex implementation mechanisms or other languages.
Nevertheless, using the class metamodel technique
it is possible to establish a nearly direct implemen-
tation of the UML state machine diagram (notwith-
standing the informal character of its semantics (Ob-
ject Management Group, 2009)) when we use an
object-oriented language and we add a simple ab-
straction level. That is even more important if we
take into account that the UML specification is given
by a class metamodel (Object Management Group,
2010b). We have reviewed the main implementa-
tion techniques concluding that the most rigorous and
efficient option would be to contemplate this meta-
model. The class metamodel technique has also been
adopted as the core of generic modeling frameworks
like EMF (Steinberg et al., 2009).
Another approach to the execution of a behaviorin
a system is the one proposed in the fUML work doc-
ument (Object Management Group, 2010a). In this
specification it is proposed to directly execute a model
with basic elements through a virtual machine. This
way, the use of an intermediate actions language pro-
vides independence from the target language (Object
Management Group, 2009).
This approach, still in beta phase, only includes a
limited set of the UML metamodel, without consider-
ing the state diagram, and needs to be materialized in
specific implementations. Also, this model requires
a level of abstraction that does not take advantage of
the potential of specific programming languages.
3 BlueState
BlueState is the execution framework for UML state
machine diagrams presented in this work. In this sec-
tion we present its class metamodel and its main mod-
ules, framed in their usage context.
3.1 Class Metamodel
Our theoretical basis is similar to EMF (Steinberg
et al., 2009), but we have eliminated a level of ab-
straction in search of specificity. In this way we aim
for a better adequacy to UML state machine diagrams
BlueState - A Metamodel-based Execution Framework for UML State Machines
227