Degenerated Inheritance

aka Diamond Inheritance, Fork-Join Inheritance

Degenerated inheritance [1][2] means that there are multiple inheritance paths (consisting of extends and implements edges) connecting subtypes with their supertypes. For languages with single inheritance between classes such as Java, this is caused by multiple interface inheritance. The presence of instances of DEGINH makes it more difficult to separate sub- and superclasses.

This antipattern is implemented as graph query (motif) as follows:


motif deginh
select type,supertype
where "supertype.fullname!='java.lang.Object'"
connected by inherits1(type>supertype) and inherits2(type>supertype) find all
where "inherits1.type=='extends' || inherits1.type=='implements'" and "inherits2.type=='extends' || inherits2.type=='implements'"
where "inherits1!=inherits2"
group by "supertype"

References

  1. M. Sakkinen. Disciplined inheritance. In Proceedings ECOOP’89, pages 39–56, 1989.
  2. G. B. Singh. Single versus multiple inheritance in object oriented programming. SIGPLAN OOPS Mess., 5(1):34–43, 1994.