Java Reference
In-Depth Information
product line be built on the DSL, and perhaps others? Is the Ecore metamodel
expressive enough to suit your needs for a DSL? How can you model dynamic
behavior?
BEST PRACTICE
Leverage existing models, when appropriate. XML Schema Definition (XSD)
and EMF are very popular technologies, and EMF can import just about any
XSD, so search for existing domain models before you reinvent the wheel.
Also consider publishing your domain model if you think that others might
find it useful, if only as part of your application's API to aid in integration.
A key consideration is the amount of flexibility you need or will tolerate in
the DSL. As you can see in the examples, sometimes a change in the domain
model makes your transformation definitions much easier to write. Also, frame-
works such as GMF have certain limitations—or, rather, were designed with par-
ticular use cases in mind. Your particular style of modeling might not lend itself
well to graphical representation, but a few changes might allow mapping to dia-
gram elements much easier. For example, certain mappings in Query/View/
Transformation (QVT) and template expressions can be facilitated by adding
derived features or methods to the domain model. Complex queries using Object
Constraint Language (OCL) (and, therefore, useful ones in QVT and Xtend) can
be added to the domain model with code generated for their implementation at
runtime. Having a feature available in the model will greatly simplify transfor-
mations and templates that access them.
TIP
Don't be afraid of modifying your domain model to make working with
templates, transformations, and diagram definitions easier. Unless you're
using a model that cannot be altered, the Toolsmith will appreciate being
able to make certain design decisions in the domain model to suit the tool-
ing, instead of having to create workarounds or write custom code to use
the tooling with a domain model.
This is not to say that you should let the tooling influence your DSL to an
extent you are not comfortable with. The question is, how do you maintain a
satisfactory level of “purity” in your DSL when considering the additional
 
Search WWH ::




Custom Search