Archive

Posts Tagged ‘metrics’

Watch your depth of inheritance

May 19, 2011 Leave a comment

One of Visual Studio’s code metrics is Depth of Inheritance (Tree).  It’s a simple integer indicating how deep the hierarchy runs on a class.  Zain describes it in a post here.

We’ve all probably had to maintain code where the programmer purists took OO just a little too far.  Yes you get reuse, but with inheritance gone awry, you may just get some programmers throw their hands in the air and rewrite the code – what reuse have you got then?  Keep it balanced folks.

At the end of that post Zain cites some articles that suggest 5 or 6 as an upper limit for DIT.  See what you think.

-Krip

Advertisements