Implementing Associations / UML 2.0 to Java 1.5

File (PDF)

Implementing Associations / UML 2.0 to Java 1.5.pdf

Review

Intro

MDD : Mapping embedded system designs to :

  • low level implementations
  • system verification tools

The UML standard does not include a complete semantics of n-ary associations so it is not surprising that the tools do not support them.

The UML standard does not include a complete semantics of n-ary associations so it is not surprising that the tools do not support them. Also the last few concepts (subsetting, derived union,and redeļ¬nition) are concepts only introduced with version 2.0 of the UML, so it is not surprising that at the time of writing this paper they are not yet supported. However, it is disappointing that only three of the reviewed tools (EMF,Octopus and Fujaba) generate code that correctly supports the bi-directional semantics of an association; and only one of these (Octopus) supports the full complement of different collection types.

Properties' characteristics

Classifier
same as Class
Property
field from a Class
Composite Property
object owner acts as container of the property.
isUnique, isOrdered
defines if the elements are unique / defines the type of the collection
isDerivedUnion
readOnly & value derived from subseted properties.
[x..y] boundary
change the collections to assert the bounds checking
isReadOnly
assigned only once ; disabling setter and returning unmodifiable collections
isID
for code generation doesn't really matter

Ordered Associations

No standard java class for OrderedSet.
3 solutions :

  • Use interface SortedSet and implement the Comparator based on insertion order.
  • Provide an explicit implementation extending List and Set java classes
  • Use Set as interface and provide implementation based on List.

Qualified Associations

Given a qualifying field and a qualified object the number os objects at the other end will be the defined multiplicity :

  • 0..1 = qualifying field must be unique
  • 0..* = qualifying field partitions the set of elements working as a classifier for each part. Returns a set of objects with the same qualifying field. Sugests an implementation with easy access using the qualifying field

Implementation using unlinked properties (within the class)

  • Can be done using a Map in the Class A matching for each qualifying of B the B instance.
  • Using a tuple middle class which stores the qualifying value and has a *-many association with both A and B.

The combination of qualifiers with other characteristics remains as future work.

Notes

The author try to be strictly consistent about using Java libraries. The key idea is that if it is not available in the Java language he doesn't want to commit with a custom solution/implementation.

References

Bibliographic Description

@article{journals/sosym/AkehurstHM07,
    title = {Implementing associations: UML 2.0 to Java 5.},
    author = {David H. Akehurst and Gareth Howells and Klaus D. McDonald-Maier},
    journal = {Software and System Modeling},
    number = {1},
    pages = {3-35},
    url = {http://dblp.uni-trier.de/db/journals/sosym/sosym6.html#AkehurstHM07},
    volume = {6},
    year = {2007},
    biburl = {http://www.bibsonomy.org/bibtex/2eb302a31c2c966b5d02652e0df0a7f35/dblp},
    description = {dblp},
    ee = {http://dx.doi.org/10.1007/s10270-006-0020-1}, date = {2008-03-31},
    keywords = {dblp }
}
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License