The idea of using standardized modeling constructs while
defining domain-specific languages is often raised. Supporting
arguments include easier language definition and reuse of existing
already working languages and their constructs. Sometimes another,
and usually hidden, argument is that the tool used does not allow
anything else. A classical example is the use of UML profiles.
A much more powerful approach to define languages is to work
directly with the metamodels. Based on our experience this is much
easier too. Basically, we may:
- Extend the existing metamodel (add new constructs, and I
consider here extending existing language constructs with profiles
one option too)
- Modify the existing metamodel (add, delete, modify)
- Define the metamodel from the scratch
- Define the metamodel and possible reuse individual language
constructs
With MetaEdit+ all these options are possible, but clearly 3
& 4 are the most successful ones: both in terms of the effort
needed when defining the domain-specific language and more
importantly in terms of the productivity gains obtained with the
language. Option 2 would also be good, but this is not usually
possible since the problem domain is usually different. We know
this very well, since although the current version of
MetaEdit+ comes
with 1135 language constructs (metamodel elements), hardly ever
existing complete languages are used as a basis to define
domain-specific modeling languages. Parts of them, however, can be
reused.
Consider for instance the domain of developing mobile phone
applications (
Chapter 1 in
DSM book ). A sample model for
one mobile application is visible
here .
Would it make sense to even try to define similar high-level
language using existing standardized modeling concepts? Obviously
not. The use of profiles does not make sense since the amount of
new stereotypes, tagged values and constraints would be huge. The
language definition would take ages and we don't even speak about
maintenance of it or making generator to produce the running
application code. Also the use of existing standardized languages,
such as UML, BPMN or SySML, as a basis and then starting to modify
their metamodels is not a reasonable option: We would need to
remove first over 99% of their concepts! If you don't believe, try
to implement a modeling language for mobile application development
based on UML metamodel (or profiles).
When it comes to the effort needed, the language for the mobile
domain was implemented in 4 days along with the editor. This
language was developed from scratch. Implementation of the
generator took other 6 days producing executable complete code (in
Python). Nothing was reused from existing modeling languages,
although some constructs, like start and stop states, could be
reused. In MetaEdit+ the effort to define Start and Stop state and
their connections with other constructs is just 1-2 minutes, so
reuse is not so crucial here.