Book a Demo

Author Topic: Associations and attributes  (Read 3203 times)

molla

  • EA User
  • **
  • Posts: 40
  • Karma: +0/-0
    • View Profile
Associations and attributes
« on: August 27, 2003, 04:11:24 am »
When we define a named association between two classes in EA, this becomes an attribute in code generation, but is not shown as an attribute in the RTF document generated. In this case the code and the documentation do not match. The association is shown in the documentatioin in the list of associations for the class, but its name is not displayed, and it is also not listed within the attributes.

Am I missing something obvious?

Thanks,

Dr. Levent Mollamustafaoglu

Sean Kearon

  • EA User
  • **
  • Posts: 126
  • Karma: +0/-0
    • View Profile
Re: Associations and attributes
« Reply #1 on: August 27, 2003, 07:31:41 am »
Hi Molla

This is correct as I understand it.  The association in the UML describes a link between two classes.  You can name that link by either providing a Link Name or a Role Name for one or both of source/target roles.  If provided, these will appear in the RTF documentation.

However, the code that implements this relationship between the two classes will be a field or property of one of the classes - there being one field/property per direction of the association - navigability in the UML being implemented by the availability of the field/property.

If I want to specify (in the UML) the name of the field/property that will implement the association in the code, I always use a Role/Link Name.  Otherwise, I use the name of the class at the other end of hte association as the default.  

It is a matter of style, but I never add an attribute to the UML as well as an association as I feel that this clutters up the model.  I also feel that the structural relationship of the association is better shown using an association.

HTH

Sean