Author Topic: Inheritance and embedded elements  (Read 2105 times)

beginner

  • Guest
Inheritance and embedded elements
« on: June 10, 2010, 04:57:35 pm »
A question to the UML gurus: I have a class A with embedded elements (here: ports) and another class B with generalization to A. Would in that case have B the same ports as A? And if so how would these inherited ports appear (in an UML tool like EA)?

Most likely Superstructures has an answer to this but I can't find it.

b.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 6982
  • Karma: +151/-112
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Inheritance and embedded elements
« Reply #1 on: June 10, 2010, 06:17:20 pm »
Good question!  (I don't have a normative answer)

If it were up to me, I'd represent them as slightly grayed out to indicate they aren't really there...

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

beginner

  • Guest
Re: Inheritance and embedded elements
« Reply #2 on: June 10, 2010, 08:38:32 pm »
Thanks. Sounds reasonably. But...

Someone else having lurked in the right portion of Superstructures?

b.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 9733
  • Karma: +286/-30
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Inheritance and embedded elements
« Reply #3 on: June 11, 2010, 04:35:38 pm »
From UML 2.3 superstructure: 9.3.8 EncapsulatedClassifier (from Ports)
Quote
/ownedPort: Port [0..*]
The set of port attributes owned by EncapsulatedClassifier. (Subsets StructuredClassifier::ownedAttribute)

In other words, the ownedPorts association is nothing more then a subset of the ownedAttributes.
Ergo: if a class inherits its attributes it also inherits its ports.

Geert
« Last Edit: June 11, 2010, 04:36:09 pm by Geert.Bellekens »

beginner

  • Guest
Re: Inheritance and embedded elements
« Reply #4 on: June 11, 2010, 04:57:10 pm »
Hu. Blind I am! There's a little checkbox "Show inherited" on top of the Embedded Elements dialogue. And it works!

Thanks.

b.

beginner

  • Guest
Re: Inheritance and embedded elements
« Reply #5 on: June 11, 2010, 05:19:28 pm »
The price for an early adopter (which I probably am). The shape scripts from the profile are not applied to the inherited ports. I'll report a bug.

b.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 6982
  • Karma: +151/-112
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Inheritance and embedded elements
« Reply #6 on: June 11, 2010, 05:41:50 pm »
Quote
The price for an early adopter (which I probably am). The shape scripts from the profile are not applied to the inherited ports. I'll report a bug.

b.
Hi b,

Are you sure it's a bug?  (Caveat - I haven't tried the actual functionality but am arguing from first principles)

Since the inherited Ports (as opposed to Realized Ports) don't actually exist in the specialization, how can they trigger the shape script?  I mean the inherited Attributes aren't there either...

If you're saying there's a problem with the shape script in the Generalization then that's not what I understood.

Paolo
« Last Edit: June 11, 2010, 05:42:33 pm by PaoloFCantoni »
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

beginner

  • Guest
Re: Inheritance and embedded elements
« Reply #7 on: June 11, 2010, 09:03:11 pm »
It's definitely buggy. I've played with 850 and the latest build.

850: Created the inherited port. It's empty with no trace to it's parent
857: The ports show the inherited tagged values, though not rendering the according shape

850: added tags manually; shapes show nicely (as work around)
875: elements show blank initially; clicking them once reveals the shape

So definitely there's a can of worms here. I filed a bug list.

I would expect to actually see the rendering as from the parent. Obviously the corrected that the inherited tags will be shown. Of course it makes sense to use the parent's rendering. Imagine a port with a direction arrow. When I change the parent, the child should do as well.

b.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 6982
  • Karma: +151/-112
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Inheritance and embedded elements
« Reply #8 on: June 11, 2010, 09:58:48 pm »
Quote
[size=18]...[/size]
So definitely there's a can of worms here. I filed a bug list
Certainly looks like it...
Quote
I would expect to actually see the rendering as from the parent. Obviously the corrected that the inherited tags will be shown. Of course it makes sense to use the parent's rendering. Imagine a port with a direction arrow. When I change the parent, the child should do as well.
I agree for definitive rendering.  But shapescripts also include conditional rendering, based on properties of the element.  So, for example, a tagged value in the parent might trigger a rendering which shouldn't be available in the child.

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

beginner

  • Guest
Re: Inheritance and embedded elements
« Reply #9 on: June 11, 2010, 10:45:35 pm »
Quote
I agree for definitive rendering.  But shapescripts also include conditional rendering, based on properties of the element.  So, for example, a tagged value in the parent might trigger a rendering which shouldn't be available in the child.
In that case you should create local tags for overwriting the inherited. Similarly to attributes/methods which can also be overwritten in the child.

b.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 6982
  • Karma: +151/-112
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Inheritance and embedded elements
« Reply #10 on: June 11, 2010, 11:48:35 pm »
Quote
[size=18]...[/size]
In that case you should create local tags for overwriting the inherited. Similarly to attributes/methods which can also be overwritten in the child.
Understood, but unlike Attributes/Methods you can omit Tags (I often use omision as implied False/Nothing).  I guess one would have to provide them explicitly...

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

fwoolz

  • EA User
  • **
  • Posts: 435
  • Karma: +0/-0
  • We have met the enemy, and he is us.<Pogo, 1970>
    • View Profile
Re: Inheritance and embedded elements
« Reply #11 on: June 12, 2010, 05:09:26 am »
I have found port rendering to be buggy, in general. For example, flow ports will often have their direction decorations disappear, then reappear after making minor changes to a drawing. And don't get me started on the perils of trying to reposition ports when zoomed out beyond a certain threshold...

There are also several port annoyances that I would love for Sparx to fix. First, why can't ports be resized manually? Second, why can't exposed interfaces be moved "out of the way" or angled as shown in the SysML specification? If ports resizing is made possible, then it should be possible to slide the interface "lollipops" along the port edges until they're where you want them to be, and then you should be able to angle them this way or that.
Fred Woolsey
Interfleet Technology Inc.

Always be ready to laugh at yourself; that way, you beat everyone else to the punch.


beginner

  • Guest
Re: Inheritance and embedded elements
« Reply #12 on: June 12, 2010, 07:13:26 am »
Not talking of auto layout.

b.

beginner

  • Guest
Re: Inheritance and embedded elements
« Reply #13 on: June 17, 2010, 12:45:32 am »
Quote
Second, why can't exposed interfaces be moved "out of the way" or angled as shown in the SysML specification? If ports resizing is made possible, then it should be possible to slide the interface "lollipops" along the port edges until they're where you want them to be, and then you should be able to angle them this way or that.
I just came across this one too. I'll submit a feature request with this thread title.

b.