[EMAIL PROTECTED] wrote:
> On Thu, Mar 20, 2008 at 11:19:27PM -0700, Chuck Esterbrook wrote:
>> To give you an idea of my use of inheritance, in the implementation of
>> the Cobra compiler I have an abstract Statement class which has a
>> subclass Expression which has subclasses such as IdentifierExpr and
>> IfExpr.
>>
>> And consider a GUI framework. Having Button and TextField inherit
>> Control makes a lot of sense. I don't see it as brittle. I do see it
>> as very real world.
> 
> There are a few places were inheritance may fit nicely like GUIs
> and exceptions I agree.  They seem few and far between.
> 
>> I don't find inheritance any more brittle than other approaches.
>> Whatever the structure of your code, you'll have to refactor it at
>> some point, probably multiple times. Avoiding inheritance won't change
>> that.
> 
> Well a long vertical inheritance chain means tight integration between layers.
> Tight integration between layers means if you mess with one layer you affect
> other layers.
> 

If that hurts, then don't do that. ;-)

I watched the alex martinelli video at google
  http://code.google.com/edu/languages/index.html#_python_patterns
which touched on this a bit.

I enjoyed the video, and recommend it.

One of Alex's remarks was exactly what you say CS, that inheritance
introduces coupling, and you should go into such arrangements knowing
what the tradeoffs are. He did say that he thought mixins were one of
the areas where inheritance especially shined.

Getting back to your original statement, I would concur that deep
inheritance trees are probably uncommon in terms of actually being
useful and justified.

Like others have said, I don't see inheritance as something to avoid.

Regards,
..jim

-- 
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg

Reply via email to