It is state of the art to provide UML modeling by means of class diagrams and code generation from there. But whereas drawing diagrams is most often well supported, code generation is limited in scope. Association classes, multiplicities, aggregation and composition are not correctly or not at all processed by most code generators. One reason may be that the UML semantics is not formally defined in the UML specification. As a result of that, associations are usually transformed into code by using properties of the same type as the associated classes or corresponding typed sets. This approach must fail although the UML2 Superstructure Specification considers association ends owned by a class to be equal to a property of the owning class. In this paper, we describe why associations should be implemented as classes when generating code from class diagrams.
[1]
Frank Budinsky,et al.
Eclipse Modeling Framework
,
2003
.
[2]
Juan Llorens Morillo,et al.
Mapping UML Associations into Java Code
,
2003,
J. Object Technol..
[3]
Ralph Johnson,et al.
design patterns elements of reusable object oriented software
,
2019
.
[4]
W. Gareth J. Howells,et al.
Implementing associations: UML 2.0 to Java 5
,
2007,
Software & Systems Modeling.
[5]
Jürgen Dingel,et al.
Mappings, maps and tables: towards formal semantics for associations in UML2
,
2006,
MoDELS'06.