Engineering Associations: From Models to Code and Back through Semantics Zinovy Diskin 1 , Steve Easterbrook 1 , and Juergen Dingel 2 1 University of Toronto, Canada {zdiskin,sme}@cs.toronto.edu 2 Queen’s University, Kingston, Canada dingel@cs.queensu.ca Abstract. Association between classes is a central construct in OO modeling. However, precise semantics of associations has not been de- fined, and only the most basic types are implemented in modern forward and reverse engineering tools. In this paper, we present a novel mathe- matical framework and build a precise semantics for several association constructs, whose implementation has been considered problematic. We also identify a number of patterns for using associations in practical ap- plications, which cannot be modeled (reverse engineered) in UML. 1 Introduction Modeling is a classical engineering instrument to manage complexity of system design. Its evolution in many branches of mechanical and electrical engineer- ing, and practically everywhere in hardware engineering, has led to automated production. We do not see significant reasons to think that evolution of soft- ware engineering (SE) will be essentially different. The recent rapid advance of model-driven development (MDD) in many areas of SE shows potential of the process (cf.[21, 13]). Particularly, there has been a real explosion in the market of forward, reverse and roundtrip engineering tools (MDD-tools). 1.1 The problem. Among modeling notations used in OO analysis and design, Class Diagrams play a central role. 1 A basic type of class diagram is a graph whose nodes are classes and edges are associations between them. The latter present relationships between classes and can bear various adornments express- ing properties of these relationships; Fig. 1 shows a few examples. The meaning of diagrams (a,b,d) should be clear from semantics of names. Diagram (c1) says that a pair of objects (c:Company, p:Position) determines zero or one Person object, and similarly (c2) says that a pair (p:Person, c:Company) determines zero or two Positions. Note that if association ends are considered as directed mappings between classes then we name them by verbs to emphasize asymmetry (diagrams a,b,c). 1 A survey reported in [10] claims that all experts participating in the study evaluated Class Diagrams as the most important and the most useful of the UML notations.