Inheritance n level deep

Discussion in 'C++' started by Gary Wessle, Nov 11, 2006.

  1. Gary Wessle

    Gary Wessle Guest

    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
     
    Gary Wessle, Nov 11, 2006
    #1
    1. Advertising

  2. Gary Wessle wrote:
    > 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
     
    =?iso-8859-1?q?Kirit_S=E6lensminde?=, Nov 11, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jason

    IIS 2 level deep

    Jason, Dec 1, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    350
    Franck Quintana
    Dec 1, 2004
  2. pabbu
    Replies:
    8
    Views:
    732
    Marc Boyer
    Nov 7, 2005
  3. One Cent
    Replies:
    7
    Views:
    5,193
    ravik
    Sep 10, 2012
  4. Eric Schwartz

    stack level too deep on ia64

    Eric Schwartz, Nov 10, 2003, in forum: Ruby
    Replies:
    3
    Views:
    159
    Eric Schwartz
    Nov 11, 2003
  5. Jesper Olsen
    Replies:
    7
    Views:
    576
    Van Jacques
    Jan 16, 2004
Loading...

Share This Page