News for hackers. Stuff that matters.
Re:Goodbye, shitty "Car extends Vehicle" object-orientation ... by yoyar on Monday August 22, 2011 @10:05PM (#2915036)
I don't think so. In a windowing library you would do better to have the IWindow interface and have both Window and ModalWindow implement IWindow. Decorator then is appropriate so that ModalWindow can wrap Window and add the desired functionality. I would not subclass Window in this case. This leaves Window and ModalWindow totally substitutable and totally decoupled. If you extend you couple Window and ModalWindow. Less coupling will likely serve you better.

I eschew inheritance except for when two objects or libraries are very much the same thing but the implementations are different. Just an example, where I might want to have the opportunity to use two different PDF libraries.

Further, there's a case where a number of objects share some common methods and you may decide to implement an AbstractWindow where those methods can live. But, you may find that Aspect programming works better in that case.

Generally, and perhaps surprisingly you shouldn't use inheritance in most cases. But inheritance is nonetheless a very important part of OOP.

Re:Goodbye, shitty "Car extends Vehicle" object-orientation ... by mweatherill on Monday August 22, 2011 @11:10PM (#2915175)
Why would you want inheritance for different PDF libraries? This seems like interface to me - the DOM interfaces are an appropriate analogy.
Re:Goodbye, shitty "Car extends Vehicle" object-orientation ... by yoyar on Tuesday August 23, 2011 @09:45AM (#2916506)
Quite right. I didn't express that very well. An interface is appropriate with implementations for each separate library.