On Thu, Mar 20, 2008 at 10:48 PM, <[EMAIL PROTECTED]> wrote: > Ever notice inheritance is that concept every programmer learns but rarely > uses? How many times how you actually made an object (is-a) hierarchy more > than 1 level deep? I'd guess most people use inheritance for mixins and > little more. > > Inheritance is just too weird and brittle to be much use in the real world. > > Anyone's mileage vary? > > Chris
I use inheritance much more than that. It was Smalltalk where I first learned OOP such that it clicked and part of the clicking included making use of inheritance for reuse. I ended up preferring file oriented languages like Obj-C and Python, but I was glad for the Smalltalk experience. 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. 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. -Chuck -- http://cobra-language.com/ -- [email protected] http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg
