Book a Demo

Author Topic: Inheritance of Required- and Provided-Interfaces  (Read 14028 times)

Ian Mitchell

  • EA User
  • **
  • Posts: 507
  • Karma: +22/-4
  • The eaDocX and Model Expert guy
    • View Profile
Inheritance of Required- and Provided-Interfaces
« on: November 19, 2013, 01:45:43 am »
I'm trying to provide an EA 'sandbox' where designers can try-out new ideas for components, based on pre-defined (read-only) existing ones.
The existing ones have lots of Provided- and RequiredInterfaces defined, with lots of operations on those interfaces.

What I was expecting to do was have them
  • create a Generalization of the existing component, so that they don't break anything
  • then add/modify interfaces/operations of the new Component
Mostly, though, they will just be re-using existing Interfaces (and their operations) from the parent.

But EA doesn't seem to inherit the ProvidedInterfaces of the parent. I'd imagined that anything which inherits from a parent inherits everything: operations attributes and implemented interfaces as well.

Any operations defined in the parent component are inherited just fine - of course - but I was surprised that the ProvidedInterfaces were not inherited as well.
Is this a gap in my understanding of (1) UML or (2) EA, or (3) just a funny in EA ?

The only way I can seem to get around this is to either
- create the ProvidedInterfaces all over again, on each of the inherited Components, which rather means there is no point inheriting the Component in the first place.
or
- doing a Copy/Paste of the parent element. This correctly copies the Provided- and Required-Interfaces. But now I've lost the fact that the new Component is related to the parent.

In both cases, if the parent changes, the children (copies) don't know. :-(, which is exactly what inheritance solves.
Ian Mitchell, Designer, eaDocX


www.eaDocX.com
www.theartfulmodeller.com

philchudley

  • EA User
  • **
  • Posts: 750
  • Karma: +22/-0
  • EA Consultant / Trainer - Sparx Europe
    • View Profile
Re: Inheritance of Required- and Provided-Interfac
« Reply #1 on: November 19, 2013, 03:27:34 am »
Hi Ian

Not sure if the following will help but here goes

It is true that if you use Expose Interface (ball & socket) then these do not get inherited with by components that have a generalization link. I guess this is because the provided / required interfaces are embedded elements.

However, if you

1) Create an Interface Class and then connect this with a realization from a component.

2) Populate the Interface Class with operations

3) Create another Component and connect to other component via generalization (quick linker does not work here!)

4) You will see a dialog giving you the opportunity to add the operations from the Interface class to you new component.

If you had already populated the Interface with operations, then the dialog gives you both the operations defined in the interface and the operations defined in the component (assuming you added them when you realised the interface)

Of course this only works for a provided interface (realization) it does not work for a required interface (usage) so I guess this does not really help at all  ;)

A quick way of creating a new component is to clone the existing component and its provided / required interfaces.

Select the component and its interfaces
Hold Ctrl and drag the selection, you will be prompted for new names for the component and interfaces.

You now have a new component with the same provided / required interfaces

Cheers
Phil
Models are great!
Correct models are even greater!

Ian Mitchell

  • EA User
  • **
  • Posts: 507
  • Karma: +22/-4
  • The eaDocX and Model Expert guy
    • View Profile
Re: Inheritance of Required- and Provided-Interfac
« Reply #2 on: November 19, 2013, 09:59:21 pm »
Thanks Phil - I think the 'Realization' route is much simpler than the 'ProvidedInterface' one.
@Sparx - why are they different ?
« Last Edit: November 19, 2013, 09:59:39 pm by ianemitchell »
Ian Mitchell, Designer, eaDocX


www.eaDocX.com
www.theartfulmodeller.com

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Inheritance of Required- and Provided-Interfac
« Reply #3 on: November 20, 2013, 01:05:41 am »
A Realization indicates that the element itself realizes some interface. The Required/ProvidedInterface are structural elements. So actually it's a semantic difference. However, you can interpret them to be mutual "the same".

q.