Width of Inheritance Tree (WIT)

CachéQuality release 
CachéQuality 1.0.0
Domain 
Code metrics
Scope 
Class

The Width of Inheritance Tree (WIT) metric provides for each class a measure of the leaves in its tree, eliminating duplicates.

A WIT value of 0 indicates a root while a value of 2 and 3 indicates a higher degree of reuse. If there is a majority of WIT values below 1, it may represent poor exploitation of the advantages of OO design and inheritance. It is recommended a maximum WIT value of 5 since wider trees constitute greater design complexity as more methods and classes are involved.

Method of calculation

Since ObjectScript supports multiple inheritance, for each declaration such as:

Class A Extends (B1, B2)

the Width of Inheritance Tree is the leaves reached by walking the dependency tree of A, then B1 and B2, recursively so until an element is encountered which does not Extends anything.

On next example, the WIT value is 3 (the green leaves):