Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Inheritance n level deep

Reply
Thread Tools

Inheritance n level deep

 
 
Gary Wessle
Guest
Posts: n/a
 
      11-11-2006
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
 
Reply With Quote
 
 
 
 
=?iso-8859-1?q?Kirit_S=E6lensminde?=
Guest
Posts: n/a
 
      11-11-2006

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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to force an internal wire which is deep inside DUT hierachy attop level testbench using VHDL design? One Cent VHDL 7 09-10-2012 10:53 PM
c is a low-level language or neither low level nor high level language pabbu C Programming 8 11-07-2005 03:05 PM
Deep Freeze In Deep Trouble johntangelo@gmail.com Computer Security 3 10-25-2005 11:49 PM
IIS 2 level deep Jason ASP .Net 3 12-01-2004 04:42 PM
stack level too deep on ia64 Eric Schwartz Ruby 3 11-11-2003 06:00 PM



Advertisments