Home > Visual Studio > Watch your depth of inheritance

Watch your depth of inheritance

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
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: