--> --> -->
Excerpted from IBM WebSphere Developer Technology Journal.
Introduction
When most people think of model-driven development, the first thing that comes to mind is to use some kind of UML model to encode and generate the corresponding artifacts from the model. However, things are not always like that. Models exist in a variety of places. A model is any component that drives a process or behavior.
Model-driven development has many goals:
- Reduce the time that is spent in developing common artifacts.
- Maintain a minimum amount of information.
- Maintaining the model in a neutral way makes it possible to generate multiple types of implementations and artifacts from the same model. For example, we should be able to use different templates to generate a Web UI and a local GUI UI from the same model.
This article introduces model-driven development through the design pattern toolbox, a template engine that supports Eclipse, to generate the appropriate applications based on customizable, model-driven architecture transformations (see Resources for a JET2 drive technology). We will describe the basics of the code generation mechanism in the Design Pattern Toolbox (DPTK), while at the same time elaborating some good design to guide you through model-driven development (MDD) code generation. These design principles make DPTK not just a toy code generator, but a full-featured model-driven development tool that can generate very complex systems. This article will focus on the basics of building pattern templates.
For more content or download the design mode toolbox, visit IBM Alphaworks.
Pattern template
The schema creator in DPTK uses tags to build schema templates. These tags have special behavior that is used to access the model, execute the logic, and accomplish a variety of other tasks. Rich tags provide a great deal of functionality and actually represent the basic artifacts needed to build any complex MDD transformation. The primary goal of the pattern template is to build the appropriate artifacts, but as we'll see in the next section, schema templates can be used to accomplish more tasks.
To better understand the relevant content, let's look at the following simple pattern templates:
Figure 1. A simple pattern template
This is a very simple DPTK view: