I had the intuition from my software engineering days, but for the last few months (due to our Forsaking Inheritance paper) I have been seeing stuff about dropping inheritance or advocating that inheritance is bad... everywhere.... from very old sources to very recent ones, spanning a period of nearly three decades...
- James Gosling 's interview that I first saw some months ago at Simon Peyton Jones' talk at the OPLSS'13 (There were two main questions: What would you take out? What would you put in? To the first, James evoked laughter with the single word: Classes. He would like to replace classes with delegation since doing delegation right would make inheritance go away. But it's like Whack-A-Mole (more laughter) since when you hit one mole, er, problem, another pops up.)
- Why extends is evil.
- Recent example from the C++ themed online conference GoingNative 2013, Inheritance Is The Base Class of Evil (general example of a talk, demonstrating that inheritance is still discussed as a "it would be best to avoid" feature.)
- Patterns for subclassing to avoid embarrassing situations with library clients, The Art of Subclassing.
- The are even refactoring options for it (e.g., IntelliJ's "Replace Inheritance with Delegation".)
- There are solutions with Java annotations like lombok's @Delegate
- delegate(*methods) in Ruby on Rails
- Go (the programming language) diverges from the usual notion of subclassing, by embedding types together (without late binding as mentioned explicitly) simplifying composition [SO]. The Gang of 4's crucial principle is "prefer composition to inheritance"; Go makes you follow it. (I liked how the so poster put it).
- The End Of Object Inheritance & The Beginning Of Anti-Rumsfeldian Modularity by Augie Fackler and Nathaniel Manista
- .... and last but not least a whole category of academic work on Subtyping, Subclassing, and the Trouble with OOP in general (article and refs by Oleg Kiselyov.)
No comments:
Post a Comment