identify software developers’ needs and their benefits
on the certain levels.
The levels 1-3 refer to the CppML Levels in
Figure 6.
Level 0 - Using the Implicit Model
This level does not appear in Figure 6 because there
is no explicit model involved. But in fact, working
with a modern IDE is already kind of model-based.
The IDE builds up an internal model on top of the
source code and allows navigating, code completion,
auto-formatting and refactoring. The source code
is the primary artifact and a model representation
is only used internally. This is common practice in
software development and probably a large number
of projects work on this level.
At this level, alternate views like diagrams are only
used for specification and documentation but not in
sync with the code.
Level 1 - Basic Structural / Language Modeling
At this level, source code is not only text anymore.
Existing source code can be reverse engineered to
a model, or code frames can be generated from
architecture models. Ideally, model and source code
stay in sync after the first transformation and support
a round-trip workflow. Otherwise, they will diverge.
The source code is just a textual representation of
the model with the ability to be regenerated at every
time. This level enables additional graphical, textual
or tabular views and the possibility to link artifacts to
other engineering domains.
On this level, the broadest possible subset of the
meta-model of the programming language should be
reflected in the meta-model of the modeling language.
Otherwise, a model would be incomplete, regarding
the level of detail needed in the programming
language.
The behavior is encapsulated in operations that
are implemented as opaque behavior. On this level,
there is not yet abstraction for scheduling, nor
support for any RTOS concepts like asynchronous
communication. The scheduling is all hidden in
opaque behavior. RTOS features can only be used in
source code without abstraction.
This level adds the benefit of enabling additional
views on existing concepts but does not yet introduce
new concepts. Class diagrams are the most commonly
used diagrams at this level.
On Level 1 the gap is that UML neither represents
the complete C++ meta-model, nor a standardized
C++ profile exists for UML. So up to now, even on
this level, models become proprietary, using either a
custom C++ profile or a tool specific built-in language
extension. A standardized mapping is required here.
Creating a proposal for such a mapping will be part
of future work. As mentioned before, it will not be
possible to cover C++ completely with this profile.
It will be in focus to identify, specify and map a
meaningful subset of C++ to UML to make it more
useful for code generation.
Level 2 - Extending the Language
At this level, for the first time, new concepts and
new views are added. Concepts that are not directly
mappable to programming language features, but can
be transformed using patterns. Behavioral models
like state behavior, with the graphical representation
of state machine diagrams, are a good example.
State behavior is hard to program textually in a 3GL
without the support of a DSL like Boost SML or
a graphical semantic. UML provides a graphical
semantic for state machines, being inspired by David
Harel (Harel, 1987). Many publications have been
written on how to generate code from state machines,
and also, many tools already support generating
code from state machines. But in a systematic
review from 2012, the authors found out that “papers
published in recent years show that the problem is still
unresolved.” (Dominguez et al., 2012)
Questions that arise when adding more complex
behavior like state behavior are: How does it integrate
with existing concepts? How is it scheduled? There
are tools out there that generate execution code
for a state machine as transition function, either as
step-function or event-based, but leave it to the user
to invoke it.
On this level, there is no abstraction for
scheduling. The scheduling stays hidden in
opaque-behavior. Model elements like signals and
other asynchronous communication concepts are not
yet supported. This level only contains concepts
that can be transformed into code without using any
libraries or frameworks.
Level 3 - Entirely Model based
On this level, the whole executable subset of
UML can be transformed and synced to code.
The concepts of behavior and how behavior is
invoked (synchronous or asynchronous) are entirely
supported. This requires an execution framework
for abstracting scheduling and RTOS concepts and
managing asynchronous communication. A part of
the code will be generated from model elements by
using patterns. Those parts should normally not be
On the Need for a Formally Complete and Standardized Language Mapping between C++ and UML
545