Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 6. Developing Model-to-Model Tra... > Transforming a Business Model to Jav...

6.9. Transforming a Business Model to Java

When generating Java or another programming language from a model, it’s typical to use model-to-text technologies, such as Xpand or JET. Ultimately, code-generation templates are required to output Java from our business domain model, so a question emerges at this point: Do we bother with an intermediate Java model, or do we pass our DNC model straight to Xpand templates for Java generation? Or should we create a model specific for Java EE? Yet another option is to define a textual concrete syntax using TMF that provides the model-to-text transformation. These are general questions you need to consider when doing Model-Driven Software Development (MDSD), and the answer will vary depending on your requirements, technology preference, relative efficiency, or other factors. In this book, we examine two approaches. This section focuses on the transformation of a Domain-Neutral Component (DNC) model to a Java domain model. The next chapter looks at the template approach for generating Java from the DNC domain model. This enables us to examine each approach in detail and to cover the relative strengths and weaknesses of each.

First, we need a Java domain model. The WebTools project maintains a Java EMF Model (JEM), which originated in the Visual Editor project. At this point, you need to install WebTools if you’re not using the DSL Toolkit from Amalgam, which includes the JEM model in its distribution. Although the model suits our needs, it also presents some challenges, such as the fact that it extends Ecore itself. We chose this model instead of implementing our own from scratch, to illustrate the challenges you might face working with an existing model, where certain restrictions and workarounds are inevitable. To make it even more “real,” the version of the model used in this section included an annotation, indicating that it was indeed a work in progress.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint