2.1 Language Workbenches and Domain-Specific Modeling
The idea of automating software development with modeling and
code generation tools is by no means new, but in many cases the adoption and
implementation of this idea has been less than perfect. The main problem with
traditional modeling tools has been the inflexibility of their language and
generator support. Fixed languages and generators may be fine when the
developers are able to use them exactly as they are, but it becomes a problem
when the need for project or organization specific extensions or changes
arises.
To address this problem, language workbenches
with customizable language and generator support have
emerged. The main benefit a language workbench like MetaEdit+ provides is the
possibility to create and use modeling languages specifically designed for
developing a particular kind of system. Such languages are usually referred to
as domain-specific modeling languages and their usage as domain-specific
modeling
(DSM).
In traditional modeling tools the languages are aimed for
as general use as possible and therefore they can provide little specific help
for any specific application domain. In contrast, DSM languages are aimed only
at a certain domain or intended use. Often, DSM languages are constructed from
the concepts and terminology found from the domain itself. For example, if we
were to create a modeling language for designing digital wristwatches, the
suitable candidates for language constructs would be such things as time units
and their arithmetic operations or user-interface elements like buttons or
icons. Using these kinds of concepts results in languages that are natural for
their domains and thus easier to learn and use for the developers. Furthermore,
with DSM it is possible to capture both static and dynamic aspects of the
modeled entity, which makes it possible to generate 100% code for the final
product automatically. Because of this, organizations adopting DSM can look
forward to a major increase in their productivity.
DSM languages alone, however, are not enough. To exploit
their possibilities fully, support environments with proper editing and code
generation features are needed. Traditionally, building such environments
– effectively bespoke modeling tools – has been expensive and
therefore possible only for large organizations. Language workbenches have
changed this: with such tools it is now possible to create the DSM environments
very quickly and inexpensively, bringing benefits to small and large
organizations alike.
The detailed explanation of the process for creating a
complete DSM environment is out of the scope for this manual, but the basic
principles are simple enough to be mentioned here. The critical success factor
for building such an environment is the domain knowledge possessed by the
organization’s expert developers. Therefore, it is their task to define
the language and code generator support. In practice this means that their
domain knowledge is embedded in the modeling tool, and thus made available to
the whole development team. For more information about how this can be done,
please see Section
2.3 and
‘MetaEdit+ Workbench User’s
Guide’.