3 ms·
Anybody have an original source for "prefer composition over inheritance"? I've heard it for years, but never with an attribution. FWIW, I noticed that in my o
by al2o3cr 13y ago
Anybody have an original source for "prefer composition over inheritance"? I've heard it for years, but never with an attribution.
FWIW, I noticed that in my old C++ book (Stroustrup '91) there's some really bogus inheritance examples - window -> window_w_banner -> window_w_menu -> window_w_banner_and_menu etc etc etc.
- djur 13y agoThe idea is presumably older, but I think the current usage can almost always be traced back to _Design Patterns_ (GoF, 1995). It's in the Introduction. I don't think Stroustrup really gets OO. I have yet to read a book of his that doesn't have some absolute howlers.
- SideburnsOfDoom 13y ago> Anybody have an original source for "prefer composition over inheritance" It is mentioned in the GoF Patterns book[1], from 1994/1995. that's what I think of when I hear the phrase. 1: http://en.wikipedia.org/wiki/Design_Patterns http://en.wikipedia.org/wiki/Design_Patterns