Rationale: According to our research, the two most frequently observed problems in implementing an inheritance hierarchy are: (1) a parent class depends on one of its children; and (2) a client class of the hierarchy depends on both the base class and its children. Both cases violate the Liskov Substitution principle since the parent class can no longer be a placeholder substitutable by any of its children. They also violate the Design Rule Theory because the parent class cannot be a decoupling design rule. They violate the Dependency Inversion Principle since a client should depend on abstractions, not on concrete implementations.
Description: DV8 detects an inheritance hierarchy to be problematic if it falls into one of the following two cases:
1) Given an inheritance hierarchy containing one parent file, f_p, and there exists a child file f_c in which f_p depends on f_c;
2) Given an inheritance hierarchy containing one parent file, f_p, with one or more children, there exists a client f_client of the hierarchy that depends on both the parent and one or more of its children.
Fig.: Instances of Unhealthy Inheritance Hierarchy architecture
dp: depend, ex: extend
The figure above presents several instances of Unhealthy Inheritance Hierarchy:
1) the parent file, ProcessorDefinition.java depends on its child file AggregateDefinition.java;
2) the parent file, JmsEndpoint.java depends on its child file JmsQueueEndpoint.java;
3) the client file DefaultManagementObjectStrategy.java depends on the parent file ManagedPerformanceCounter.java and all of its children.
To visualize an instance of Improper Inheritance using the DV8 GUI, click "Analysis-> Load Issue File", and select a ".dv8-issue" file. For an Improper Inheritance issue, DV8 will automatically arrange the files so that the parent class(es) are placed at the top of the DSM, and the clients depend on both the parent and children were highlighted, as shown in the figure.