Book a Demo

Author Topic: Association class handling  (Read 7199 times)

Frank Horn

  • EA User
  • **
  • Posts: 535
  • Karma: +1/-0
    • View Profile
Association class handling
« on: June 03, 2008, 08:08:21 pm »
Please correct me if I'm wrong, but it seems to me that the way EA handles association classes makes them next to useless.

I tend to avoid them anyway, but now that I tried something out I had to face the following phenomena:

1. Association classes can have a name and everything, but they are not visible in the project browser. The only way to get them into a second diagram is to select a class linked to them and call the "Add - Related elements" menu.

2. You can hardly control when an association class will be deleted. Maybe when all it's links have gone. But you have to read the database or an exported xmi file to see whether it's still there.

3. Delete an association class from a diagram while it still has links. Maybe you hit the delete key by mistake. How can you get you association class back? I have only found one way: call the "Add - Related elements" menu. But this will layout you diagram, which may cost you a lot of work.

Dave.B

  • EA User
  • **
  • Posts: 94
  • Karma: +0/-0
    • View Profile
Re: Association class handling
« Reply #1 on: June 06, 2008, 10:40:08 pm »
I have not experienced the problems of lost association classes. May be it is in how you are creating them?

To create an association class, I first create a class in the normal way. It is therefore visible in the Project Browser. I then use the advanced context menu on that class to turn it into an "association class".

Hope this helps
Dave B.

Frank Horn

  • EA User
  • **
  • Posts: 535
  • Karma: +1/-0
    • View Profile
Re: Association class handling
« Reply #2 on: June 07, 2008, 12:08:25 am »
Dave,

I used the "Association" symbol from the toolbox page. This creates a diamond shaped thing called "association class" which is not visible in the project browser.

What you create is just a class, and its stays a class, but it can be linked to an association.  I simply didn't know this was possible. It opens up a lot of possibilities, cause this kind of association class can have associations itself and so on. In particular it's great when I want to define properties of an association for code generation.

Thanks a lot for pointing me to that.

Frank

Dave.B

  • EA User
  • **
  • Posts: 94
  • Karma: +0/-0
    • View Profile
Re: Association class handling
« Reply #3 on: June 11, 2008, 09:36:33 pm »
The diamond shaped thing that EA calls an "association" is actually the UML "n-ary association", which is completely different from an association class.

Think of it this way: an association between two classes is a point to point relationship and is therefore referred to as a binary association. If you have 3 or more classes that each need to know about each other then you could do this with a lot of criss-crossing binary associations, or you could use the n-ary association with the diamond as the central axis to a set of radial associations to each of the classes. The effect is the same, but the diagram is neater with the n-ary association symbol. Whether the model is sensible is another matter!

OTH, an association class is a class that only exists when the associated inter-class association (between two other classes) is created between a set of those class of objects.

An n-ary association is therefore something completely different to an association class. Moreover, you just about never need to use the n-ary association, and only occasionally association classes.

I hope that helps (and I have got my descriptions right)
Dave B.

Frank Horn

  • EA User
  • **
  • Posts: 535
  • Karma: +1/-0
    • View Profile
Re: Association class handling
« Reply #4 on: June 12, 2008, 12:33:18 am »
Ok, so I mixed it up. Should have read my superstructure.

But that still leaves the inconsistency I wanted to point out: the symbol for n-ary associations is in the elements toolbox page, and an n-ary association is actually an element since it can have connectors, but EA does not show it in the project browser, so it's hard to retrieve when you have deleted it from a diagram by mistake.

Dave.B

  • EA User
  • **
  • Posts: 94
  • Karma: +0/-0
    • View Profile
Re: Association class handling
« Reply #5 on: June 12, 2008, 06:27:14 pm »
I think you've got a good point there! You should report it as a bug.

Dave B.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Association class handling
« Reply #6 on: June 13, 2008, 11:48:34 am »
Quote
The diamond shaped thing that EA calls an "association" is actually the UML "n-ary association", which is completely different from an association class.
Hi Dave,

I take a more continuous view that a binary association is a 2-ary association and thus the lozenge and the rectangular forms are just different renderings of the same underlying concept.  See Lozenge (tm) & OCL for some discussion on this, other discussions related to the "lozenge" are elsewhere...

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!