Book a Demo

Author Topic: Extending Multiple Metaclasses  (Read 5030 times)

Jayson

  • EA User
  • **
  • Posts: 363
  • Karma: +1/-0
    • View Profile
Extending Multiple Metaclasses
« on: August 12, 2020, 10:07:24 am »
Hi there

So looking at the Sparx documentation and profile helpers, it appears that you can extend multiple metaclasses when creating a stereotype.
I have also noticed that:

* Each metaclass has a distinct sub-set of the metaclass attributes, and
* The same stereotype can have the same property (for example "Source Navigability" for each of the metaclasses). For example, I could have a stereotype with "Source Navigability" = x for one metaclass and "Source Navigability" = y for another.

So my questions are:

1. Why and when would you want to do extend multiple metaclasses?
2. What happens to a stereotype that has multiple conflicting propeties (as above)?

Am I the only one that finds this super confusing?

Thanks in advance.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Extending Multiple Metaclasses
« Reply #1 on: August 12, 2020, 10:25:00 am »
No, you're not Jayson!

I asked essentially the same question last week. Metatypes - multiple inheritance precedence order?

Hopefully, some Sparxin will answer.  I put in a support request, have you.  If not, do it.  That way you get a formal response.

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

Jayson

  • EA User
  • **
  • Posts: 363
  • Karma: +1/-0
    • View Profile
Re: Extending Multiple Metaclasses
« Reply #2 on: August 12, 2020, 01:13:35 pm »
So in essence we have zero idea which properties take precedence? It just seems "weird with wheels" to me!

Thanks yet again Paolo.  :)

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Extending Multiple Metaclasses
« Reply #3 on: August 12, 2020, 01:38:11 pm »
1. Why and when would you want to do extend multiple metaclasses?
When your stereotype is relevant to multiple different element types. eg. it applies to both Association and Class.

2. What happens to a stereotype that has multiple conflicting propeties (as above)?
There's no ambiguity or conflict in the above scenario, the properties that apply are the ones that relate to the metaclass that the stereotype is being created as an extension of.

I asked essentially the same question last week. Metatypes - multiple inheritance precedence order?\
Have I misunderstood your question? Precedence of multiple occurences of an extension within an inheritance hierarchy seems unrelated to having more than one available metatype.

Jayson

  • EA User
  • **
  • Posts: 363
  • Karma: +1/-0
    • View Profile
Re: Extending Multiple Metaclasses
« Reply #4 on: August 12, 2020, 04:39:02 pm »
Hey Eve

Thanks for the reply.
However I am afraid that I am being particularly thick, cos I still don't get it.
So will try to clarify my stupidity for you.

1. If I create a stereotype that extends an Association MetaClass, Class MetaClass & an Activity Metaclass what does that even look like?
Is it a connector? Is it an element? Or some freaky combination of the two.

2. Under this scenario, both Activity and Class have a Default Diagram Type property.
If I make an instance of this stereotype composite, which Metaclass' Default Diagram Property determines which type of diagram to create.

Cheers

Jays :-)

Modesto Vega

  • EA Practitioner
  • ***
  • Posts: 1183
  • Karma: +30/-8
    • View Profile
Re: Extending Multiple Metaclasses
« Reply #5 on: August 12, 2020, 05:42:04 pm »
I am not sure I understood the "problem" but, just in case, you do not create 1 stereotype to extend 3 metaclasses. If you need to extend 3 metaclasses, you create 3 stereotypes each one extending a different metaclass.


By the way, connectors are specialised elements. The fact that Sparx chose to implement them differently is most likely an accident of history.

Jayson

  • EA User
  • **
  • Posts: 363
  • Karma: +1/-0
    • View Profile
Re: Extending Multiple Metaclasses
« Reply #6 on: August 12, 2020, 05:54:30 pm »
"If you need to extend 3 metaclasses, you create 3 stereotypes each one extending a different metaclass."

This makes 100% sense to me. However, if you look at the profile helpers it will allow me to add any number of metaclasses in the extensions box.
I am assuming that they have done this for some reason, but I will be damned if I can figure it out.

Cheers :-)

Modesto Vega

  • EA Practitioner
  • ***
  • Posts: 1183
  • Karma: +30/-8
    • View Profile
Re: Extending Multiple Metaclasses
« Reply #7 on: August 12, 2020, 06:02:08 pm »
Could you please we more specific? Which one of the 3 profile helpers are you referring to - please see https://sparxsystems.com/enterprise_architect_user_guide/15.0/modeling/using_the_profile_helpers.html?

The reasons will be different for each profile helper.

Jayson

  • EA User
  • **
  • Posts: 363
  • Karma: +1/-0
    • View Profile
Re: Extending Multiple Metaclasses
« Reply #8 on: August 12, 2020, 06:42:14 pm »
Heyo

I am talking about the "Add Stereotype" profile helper.
If you fire that up, it immediately asks you to specify:

1. Name of the stereotype.
2. Extensions (which are the metaclasses).

I can select as many metaclasses as I want to add here and it will let me.
Furthermore, it will allow me to set metaclass properties for each of them.

Cheers :-)

Modesto Vega

  • EA Practitioner
  • ***
  • Posts: 1183
  • Karma: +30/-8
    • View Profile
Re: Extending Multiple Metaclasses
« Reply #9 on: August 12, 2020, 07:40:50 pm »
The stereotype helper "helps" to create stereotype profile. It does not extend any metaclasses instead it just places the metaclasses to be extended on a (stereotype) profile package, it is up to the end-user to extend the metaclasses. I don't see a problem with this.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Extending Multiple Metaclasses
« Reply #10 on: August 12, 2020, 08:01:50 pm »
You can indeed create a single stereotype that extends multiple meta-classes.

For example myStereotype extending both Class as UseCase
I don't think there's a conflict here. All properties you set on the Class metatype are used when you create this stereotype on a class basetype.
The properties you set on the Usecase metatype are used when you create this stereotype on a UseCase basetype.

It's not how I do it usually, but it works.
I usually create separate stereotypes for each different metatype (myClassStereotype and myUseCaseStereotype) to avoid confusion.

Geert

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Extending Multiple Metaclasses
« Reply #11 on: August 12, 2020, 10:02:17 pm »
You can indeed create a single stereotype that extends multiple meta-classes.

For example, myStereotype extending both Class and UseCase
I don't think there's a conflict here. All properties you set on the Class metatype are used when you create this stereotype on a class base-type.
The properties you set on the Usecase metatype are used when you create this stereotype on a UseCase base-type.

It's not how I do it usually, but it works.
I usually create separate stereotypes for each different metatype (myClassStereotype and myUseCaseStereotype) to avoid confusion.

Geert
As Geert says, it's not how one normally wants to do it, but it works.
There's the perennial Association vs Association Class problem and we think we'll need a "DB SChema" metatype for both Classes and Packages - since we will want to group DB items by their schema into folders, but also have Schemas as first-class items themselves.

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

Modesto Vega

  • EA Practitioner
  • ***
  • Posts: 1183
  • Karma: +30/-8
    • View Profile
Re: Extending Multiple Metaclasses
« Reply #12 on: August 13, 2020, 12:29:55 am »
[SNIP]
It's not how I do it usually, but it works.
I usually create separate stereotypes for each different metatype (myClassStereotype and myUseCaseStereotype) to avoid confusion.
This has been my point all the way through.

[SNIP]
I don't think there's a conflict here. All properties you set on the Class metatype are used when you create this stereotype on a class basetype.
The properties you set on the Usecase metatype are used when you create this stereotype on a UseCase basetype.
There is one scenario, which I cannot remember, in which some of the properties of the extending stereotype are applied to the metaclass. In this case, if you have 2 stereotypes extending the same metaclass one could/would overwrite the properties of the other.