Author Topic: Attributes vs. associations  (Read 2174 times)

EvilGraham

  • EA Novice
  • *
  • Posts: 15
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Attributes vs. associations
« on: November 29, 2005, 06:25:28 am »
Hi,

I'm quite new to this tool and I noticed that its behaviour is a little different to other tools regarding how it handles associations and attributes.

For example, if I make 2 classes A and B then draw an aggregation between them, the (C++) code generated for each class won't have a class attribute that refers to the other class.

It seems that if you want class A to hold a reference or pointer to class B you must explicitly add the attribute to class A yourself, it's not enough to draw a line between them and annotate it.

Does anyone know if this behaviour is by design?

Thanks
Graham

EvilGraham

  • EA Novice
  • *
  • Posts: 15
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Attributes vs. associations
« Reply #1 on: November 29, 2005, 06:47:39 am »
I tried some more experiments and this seems to apply only one way. In other words if you name the source role and target role in an aggregation it will only generate an attribute in one of the classes, even if you specify the link as bidirectional

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8085
  • Karma: +118/-20
    • View Profile
Re: Attributes vs. associations
« Reply #2 on: November 29, 2005, 01:11:35 pm »
Hi Graham,

For aggregation links the attribute will only be generated if the corresponding role has aggregation of either 'shared' or 'composite'.  Associations use this and the direction of the link.

EvilGraham

  • EA Novice
  • *
  • Posts: 15
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Attributes vs. associations
« Reply #3 on: November 30, 2005, 01:56:45 am »
Thanks, that did it.

By the way, I think the help text is slightly out of sync with the dialog box when you bring up aggregation properties (and then push "Help").

The text says "Aggregate -> Check if role is an aggregate" (implying that there's a check box, when it's a drop-down list) and the "Changeable" drop-down list is not documented at all.

Many thanks for your help.

Graham