Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

"Prefer composition over inheritance" is actually a well-known mantra and appears in, for example, the Design Patterns book from 1994, which is basically the OOP bible. And this is within the OOP bubble, you won't even find inheritance outside of it.

https://en.wikipedia.org/wiki/Design_Patterns

Don't take undergraduate OOP courses seriously.



> a well-known mantra

which isn't an explanation, but just the same as the OOP mantra that was taught in undergraduate courses.


One reason is the unstable base class phenomenon. A some changes in the base class require you to constantly change all your derived classes.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: