Book a Demo

Author Topic: How to... Association Class  (Read 6563 times)

Miguel Gonzalez

  • EA User
  • **
  • Posts: 22
  • Karma: +0/-0
    • View Profile
How to... Association Class
« on: March 22, 2011, 07:15:14 am »
How do I represent an Association Class in EA?

In UML, an Association Class is represented with a dashed line linked to the solid line that associates two classes.

See Figure 2 on http://www.agilemodeling.com/style/classDiagram.htm.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: How to... Association Class
« Reply #1 on: March 22, 2011, 08:29:10 am »
There is an association class element on the class toolbox.

There is also the ability to link an existing class and association into an association class.

Miguel Gonzalez

  • EA User
  • **
  • Posts: 22
  • Karma: +0/-0
    • View Profile
Re: How to... Association Class
« Reply #2 on: March 22, 2011, 05:37:04 pm »
Thanks Simon, that worked.

Miguel Gonzalez

  • EA User
  • **
  • Posts: 22
  • Karma: +0/-0
    • View Profile
Re: How to... Association Class
« Reply #3 on: March 22, 2011, 06:26:55 pm »
One more thing though...

How do you code this association class? I have created the UML and then generated the code but I cannot see how they connect.

Thanks.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: How to... Association Class
« Reply #4 on: March 23, 2011, 06:43:44 am »
The code generation in EA doesn't touch association classes.

Miguel Gonzalez

  • EA User
  • **
  • Posts: 22
  • Karma: +0/-0
    • View Profile
Re: How to... Association Class
« Reply #5 on: March 23, 2011, 06:48:15 am »
How is that? Is there a reason for this? I would really like to know, details about this kind of things will help me to better understand the use of EA.

Thank you.

Kevin G. Watson

  • EA User
  • **
  • Posts: 217
  • Karma: +0/-0
  • I love EVERYTHING including Microsoft
    • View Profile
Re: How to... Association Class
« Reply #6 on: March 23, 2011, 10:39:47 am »
hi'ya Miguel

I think the main reason, aside that Sparx workforce haven't a clue - they are UML model vendor;  usually it's because there is more than a couple of ways of expressing the construct.

What would you like the EA Code generator to produce?

Couple simple cases, and you might inspire some 'Code Generator Template' head to hack out a partial solution...

Have you tried IBM/Rational's SA or Altovia's Umodel...

And remember the code gen from State and Activity diagrams is only forword engineerable... no reverse capablities

Does not having this functionality impact youre productivity much?

Kevin [smiley=2vrolijk_08.gif]

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: How to... Association Class
« Reply #7 on: March 24, 2011, 03:58:03 pm »
Miquel,

At almost any client I worked for the last 7 years AssociationClasses were banned (and they weren't even using code generation). The main reason for the ban on AssociationClasses is that they are often not completely understood by the modellers, and usually completely not understood by other stakeholders (Business, developers,...).

For each construction with a AssociationClass you can think of a solution using regular classes and regular associations.

I guess Sparx had the same feelings about AssociationClasses when they decided to ignore them in code generation.

Geert

Miguel Gonzalez

  • EA User
  • **
  • Posts: 22
  • Karma: +0/-0
    • View Profile
Re: How to... Association Class
« Reply #8 on: March 25, 2011, 10:11:43 am »
Hi Geert and thank you for your reply.

I understand what you say, why to implement something that almost no one uses? Why to make more complex a tool.

Still, Association Classes make so much sense to me that I wish more developers would understand them, in fact, I have been looking for an article that could explain the concept well and I found one that I would like to share with those out there that haven't had the opportunity to meet association classes... http://www.devx.com/enterprise/Article/28576

Having a Man class and a Woman class, a possible relationship between them is a marriage. The solid line that links Man and Woman is the association marriage. But details like the date of marriage does not belong to the Man class or to the Woman class, it belongs to the marriage association itself and here is when we elevate the simple association to an association class.

Anyway, in case Spars is planning some work on this area, I would like to offer my feedback on how Association Classes are done on EA.

It is not easy with EA to create association class, well, it is easy if you knew beforehand that you want an association class, you just select the tool and create it, but the normal flow when modelling would be that you have two classes linked with an association and after some refining process you decide to elevate an association to association class, on this case it is not easy, you have to destroy the association, delete one of the classes and then use the association class tool on the remaining class which will create the association class and a second class where you will have to replicate as per the class you previously deleted.

I may be wrong but it seems to me that this is the way to do it. I would appreciate if someone could tell me an easier way of doing this, how to elevate an association between two classes to association class without damaging any of the two initial classes.

Thanks.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: How to... Association Class
« Reply #9 on: March 25, 2011, 10:33:25 am »
Drop a new class on
Right click
Advanced | Association Class
Select the appropriate association from the list.

Miguel Gonzalez

  • EA User
  • **
  • Posts: 22
  • Karma: +0/-0
    • View Profile
Re: How to... Association Class
« Reply #10 on: March 25, 2011, 10:38:32 am »
Yeap, that's far much easier.

Thanks a lot Simon.