Book a Demo

Author Topic: Multiple Inheritance and feature override  (Read 5687 times)

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Multiple Inheritance and feature override
« on: June 13, 2005, 07:40:34 pm »
EA allows the explicit overriding of an operation when you inherit via a generalization.

Unfortunately, it doesn't (orthogonally) extend this to attributes in a formal fashion.  It does it by implication.  If you inherit an attribute x from class A it will appear on the inherited display as:
::A
  x

If you declare a local attribute x, EA implicitly assumes that you are overriding the inherited x  and removes it from the inherited list.  This is (I guess) OK for single inheritance (although why does EA explicitly ask about operation override), but it is not OK for multiple inheritance.

EA appears to make no provision for one of the issues involved in multiple inheritance: Renaming
Where a feature with the same name is inherited from two different ancestors, a decision needs to be made:
1)    Is it a special case of repeated inheritance (common ancestor) and therefore we can say all the instances are the same thing.  There is only one feature with one name.
2)    Even though it is a case of repeated inheritance or not the semantics of the same named feature are not the same at this point.  They are therefore not the same thing.  There are two features that require two names.

It seems to me that more formal support is needed in EA for these types of issues:
1)    The ability to formally denote redefinition (override) to stop me accidentally mistyping the name of a local feature and thus implicitly overriding the inherited one.
2)    The ability to formally denote the renaming of an inherited feature.

Thoughts anyone?

Incidentally, I thoroughly recommend Chapters 14 & 15 of Object-Oriented Software Construction by Bertrand Meyer for an excellent exposition of the issues involved in inheritance (particularly multiple).

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

sargasso

  • EA Practitioner
  • ***
  • Posts: 1406
  • Karma: +1/-2
  • 10 COMFROM 30; 20 HALT; 30 ONSUB(50,90,10)
    • View Profile
Re: Multiple Inheritance and feature override
« Reply #1 on: June 13, 2005, 08:10:35 pm »
Quote
Chapters 14 & 15 of Object-Oriented Software Construction by Bertrand Meyer


Paolo,

You have much, much , much to much time on your hands.

;D (At least I go out occassionally and go and watch some paint dry.)
« Last Edit: June 13, 2005, 08:14:16 pm by sargasso »
"It is not so expressed, but what of that?
'Twere good you do so much for charity."

Oh I forgot, we aren't doing him are we.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Multiple Inheritance and feature override
« Reply #2 on: June 13, 2005, 08:19:57 pm »
Quote

Paolo,

You have much, much , much to much time on your hands.

 ;D (At least I go out occassionally and go and watch some paint dry.)


Hey,  I read them over 8 years ago!  Before I met Betrand (name dropper!) - turns out he studied under the same guy that started me on conceptual modelling in 1978! (Jean Raymond Abrial - virtually unknown outside of France)

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