sign in | join about | help | sitemap
Connecting Tech Pros Worldwide
Gary Wessle's Avatar

Inheritance n level deep


Question posted by: Gary Wessle (Guest) on November 11th, 2006 07:15 AM
Hi

is there some guide lines on how many level deep once can structure
the inheritance, I have 3 level deep inheritance setup and just
wondering whether this is the norm?
each level is generated by the presence of commonality in concept
between the classes.

thanks
1 Answer Posted
Kirit Sælensminde's Avatar
Kirit Sælensminde November 11th, 2006 08:45 AM
Guest - n/a Posts
#2: Re: Inheritance n level deep


Gary Wessle wrote:
Quote:
Originally Posted by
is there some guide lines on how many level deep once can structure
the inheritance, I have 3 level deep inheritance setup and just
wondering whether this is the norm?
each level is generated by the presence of commonality in concept
between the classes.


You've no doubt noticed that the language provides no limit, but that
isn't really the question.

The level at which a hierarchy is _too_ deep is when you cannot
comprehend it. Like function size, hierarchy depth is more about our
(as programmers/developers) inability to comprehend large structures
than about the compiler's abilit - and I think that depth isn't that
much more important than width.

You need the part of the hiararchy that you're working on to be clear
in your mind, but often you will find that the root of a hierarchy may
be sufficiently abstract that it can be ignored for many purposes - the
hierarchy has clear stratification that helps to keep it manageable.

Clear naming, good documentation and UML diagrams can also help us to
understand larger hierarchies.

The simplest rule is that if you find yourself getting confused it's
already too big. As you get better at designing them your abstractions
and layering will get better and you'll find that you can build and use
larger hierarchies without a huge increase in complexity.


K

 
Not the answer you were looking for? Post your question . . .
197,013 members ready to help you find a solution.
Join Bytes.com

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 197,013 network members.
Post your question now . . .
It's fast and it's free

Popular Articles

Top Community Contributors