1 Dec 2003 01:14
Re[2]: Circle/Ellipse dilemma
Michael Feathers <mfeathers <at> mindspring.com>
2003-12-01 00:14:20 GMT
2003-12-01 00:14:20 GMT
WR> Anne & Larry Brunelle wrote: >> "Behaves-as" sounds like it could include >> private inheritance - which is usually not >> really a proper inheritance relationship, >> but rather only (in hope) a convenient >> implementation. Or worse. WR> Inheritance is overrated... and, in any case, is only a convenient WR> implementation for propagating behaviour. It seems like the industry did swing back hard against inheritance. In the middle 90s, the swing went away from inheritance. Microsoft had their own internal inheritance debacles which ended up with an object model that didn't have implementation inheritance (COM), and the GOF Design Patterns book pretty much recommended against it, showing that delegation was more flexible. I suspect the move towards "components" had something to do with it also. But frankly, I use inheritance now more than I ever have. There are a couple of reasons: 1) It is easy to subclass and add behavior to make a test pass. When you've done that, you can use the tests to safely move to another mechanism whenever you decide to. No need to start that way. 2) Inheritance is a great mechanism for replacing code. If you have a legacy class that depends on something weird that it shouldn't depend on in a test, you can subclass and replace that code to get the class under test.(Continue reading)
Michael Feathers

RSS Feed