Re:Paul Graham on Spaghetti Code
by Ensorceled on Friday April 19, 2013 @08:08AM
(#5576138)
Yeah, I was asked to model a graphics program in an interview and got into a argument about why circles should not be a subclass of ellipse. I explained that, yes, mathematically it's a degenerate case, but in a graphics package circles have different algorithms and different user interfaces. They actually have more in common with squares than ellipses.
After about 10 minutes of no progress, I suddenly realized I would be working with and for idiots so I excused myself from the rest of the process.
Yeah, Liskov Substitution Principle. I believe that (mutable) circle and (mutable) ellipse is the chief example of the bad kind of inheritance wrt to this rule.
I'm reminded of Pirsig's comments on the multiple ways you could break down a motorcycle, for example.
The tyranny of the dominant decomposition is no joke, especially when single inheritance and single dispatch are so popular.
Late nineties, good times, OO was the silver bullet back then :)