Base Templates

The Code Template Framework consists of a number of base templates. Each base template transforms particular aspects of the UML to corresponding parts of object-oriented languages.

Topics

Topic

Detail

See also

Further Information

The base templates form a hierarchy, which varies slightly across different programming languages.

In a typical template hierarchy relevant to a language like C# or Java (which do not have header files) the templates can be modeled as Classes, but usually are just plain text.

This hierarchy would be slightly more complicated for languages like C++ and Delphi, which have separate implementation templates.

Each of the base templates must be specialized to be of use in code engineering; in particular, each template is specialized for the supported languages (or 'products').

For example, there is a ClassBody template defined for C++, another for C#, another for Java, and so on; by specializing the templates, you can tailor the code generated for the corresponding UML entity.

Once the base templates are specialized for a given language, they can be further specialized based on:

•

A Class's stereotype

•

A feature's stereotype (where the feature can be an operation or attribute)

This type of specialization enables, for example, a C# operation that is stereotyped as «property» to have a different Operation Body template from an ordinary operation; the Operation Body template can then be specialized further, based on the Class stereotype.