Book a Demo

Author Topic: Changing an Association to an AssocationClass  (Read 4604 times)

Modesto Vega

  • EA Practitioner
  • ***
  • Posts: 1183
  • Karma: +30/-8
    • View Profile
Changing an Association to an AssocationClass
« on: May 23, 2023, 11:03:25 pm »
Is there an easy way to change the type of a connector from an Association to an AssociationClass?

Alternatively, is there are an easy way of changing the 3rd class involved in an AssocationClass? The 3rd class involved in an association class is neither the source nor the target.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Changing an Association to an AssocationClass
« Reply #1 on: May 24, 2023, 07:22:31 am »
You make an association class by attaching the association class element to an association via the context menu. In the end you have both an association and an AssociationClass element. There is not "alter" command like changing a class into another element. The construct in EA is a bit of a bastard. Connectors have always been 2nd class citizens here. As long as you stick to tha GUI it's ok. Just don't look under the hood.

q.

Modesto Vega

  • EA Practitioner
  • ***
  • Posts: 1183
  • Karma: +30/-8
    • View Profile
Re: Changing an Association to an AssocationClass
« Reply #2 on: May 24, 2023, 07:03:08 pm »
Thanks Thomas, the out-of-the-box functionality "does not cut the mustard", it leads to content duplication in the repository. But an AssociationClass as defined in
Quote
11.5.3.2 Association Classes
An AssociationClass is a declaration of an Association that has a set of Features of its own. An AssociationClass is both
an Association and a Class, and preserves the static and dynamic semantics of both. (p. 200)

Does exactly what I am after?

Although, after looking at the examples in pages 207 and 208 (figures 11.35 and 11.36), I am not sure I fully  understand
Quote
An AssociationClass describes a set of objects that each share the same specifications of Features, Constraints, and semantics entailed by the
AssociationClass as a kind of Class, and correspond to a unique link instantiating the AssociationClass as a kind of
Association. (also p. 200)
In those 2 examples, person, company and job  have different features, the only thing they have in common is the salary and the relationship - i.e., relating a person to a company.



qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Changing an Association to an AssocationClass
« Reply #3 on: May 24, 2023, 07:42:40 pm »
Well, simpy speaking, an association class associates two or more classes by adding properties/operations. The dashed line rendering is a shortcut for the AC sitting between the associated classes holding unique association to each. In paractice you would e.g. show a schedule between person and task as such. You connect person and task by PersonTask AC which then adds e.g. properties likes TimeWorked or the like.

q.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Changing an Association to an AssocationClass
« Reply #4 on: May 24, 2023, 07:46:47 pm »
with "a set of objects" they mean like in the definition of a class is a set of instances.

So the associationclass is the Job, which means there can be a set of objects of type Job that have these common features, constraints and semantics.

- MyJob : Job
- YourJob : Job
- ...

Geert

Modesto Vega

  • EA Practitioner
  • ***
  • Posts: 1183
  • Karma: +30/-8
    • View Profile
Re: Changing an Association to an AssocationClass
« Reply #5 on: May 24, 2023, 08:52:44 pm »
Thank you Geert and Thomas.

I guess there 2 threads intertwined here: a usability issue and a modelling query.

Hopefully Sparx Systems can make some enhancements to make connectors a first class citizen, specially connectors such as AssociationClass. In my opinion, this long overdue. But I don't expect anything.

with "a set of objects" they mean like in the definition of a class is a set of instances.

So the associationclass is the Job, which means there can be a set of objects of type Job that have these common features, constraints and semantics.

- MyJob : Job
- YourJob : Job
- ...

Geert
I this example, I am expecting a complex set containing instances of the 3 classes involved:
- Your Job : Job | You : Person | Your Company : Company
- My Job : Job | Me : Person | My Company : Company
- ...

Is this is what is meant with "a set of objects" then the AssociationClass does exactly what I want to achieve and brings me back to the usability issue.

Ultimately, I prefer to model because it gives me a cleaner model.

Person ------------- Company
                    |
                  Job

Than

Person ------ Job ----- Company

Both represent the same thing, but the usability issue almost enforces the 2nd option because there is no easy way to transition to the 1st option.


Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Changing an Association to an AssocationClass
« Reply #6 on: May 24, 2023, 09:17:24 pm »
Yes, that's what I meant, except that the assocationclass itself only describes the objects of type Job, including the links (instances of the association) between the different person and company objects.

About the usability
I think you can, switch between regular classes and associations classes in EA.

If you have
Person ------ Job ----- Company
Then you

- Create an association between Person and Company
- Right click on Job and select Advanced | AssociationClass
- Select the association between Person and Company.
- Delete the two existing associations

The other way around:

- Select the association of the associationclass, and press delete
- Choose to delete (and not hide) the relation
- Select "No" to the question whether to delete the class as well as the association
- Create the associations between Job and Company, and Job and Person.

Might not be the easiest way to do it, but "good enough" in my book.

Geert

Modesto Vega

  • EA Practitioner
  • ***
  • Posts: 1183
  • Karma: +30/-8
    • View Profile
Re: Changing an Association to an AssocationClass
« Reply #7 on: May 24, 2023, 09:27:49 pm »
Thank you Geert, I will give a try.