standard UML-to-code-mapping(Forward Engineering)?

modeling, specifications, standards, uml

Solution

There is no one translation from UML to code. That's due to a number of reasons, including:

What bits of UML you use and how. UML is a large language. Historically it has been much stronger on the static side of things (classes, associations, packages) than on the dynamics. It's only comparatively recently that UML has acquired the action semantics required for executable models. And in comparison to the more established static elements, these newer parts aren't (yet) well supported. This has arguably been a major reason why canonical MDA transforms haven't become more widespread.

It's possible to target different programming languages. Translation to 3rd generation OO languages is probably most popular. But it's also possible to translate into other languages: C is a popular choice, especially in the embedded world.

Different translation rules are possible depending on the needs of the particular environment.

That said, there are some popular idioms. For example:

- UML packages, classes and attributes are often mapped directly to their OO 3GL counterparts. In fact, many UML models are just graphical renditions of 3GL OO code.

- UML relationships are usually split in two, with pointers/references stored in each relationship end.

- There are 3 common models for translating UML state models (or more generally any state model): nested switches, state tables and the state pattern.

Action Languages are too new/not well enough supported for there to be canonical mappings. That said, the specs pretty closely mirror typical 3GL constructs: if/then/else control statements, assignments, etc. The semantic gap between model and target is therefore pretty small - so translation should be reasonably straightforward.

hth.

Problem

I wonder if there is widely accepted standard for the UML(unified modelling language)-to-code-mapping(Forward Engineering)?

Original source