2 ms·
I think the refrain has more to do with inheritance being heavily promoted as the reason for doing OO in the early 90's till the mid 00's. I believe even Bjarne
by BeetleB 3y ago
I think the refrain has more to do with inheritance being heavily promoted as the reason for doing OO in the early 90's till the mid 00's. I believe even Bjarne Stroustrup said if you're not doing inheritance, it's not OO and you should stick to C.
Also, while one can do composition about as easily as inheritance, it still has its warts in languages like C++. If you want to unit test code, it's recommended to use dependency inversion instead of regular composition - there are other good reasons to do DI as well. But when you start coding the same stuff in non-OO paradigms, you realize that it's just much easier - stuff like DI was popularized to get around the flaws of the OO implementation in those languages. The same goes for most OO design patterns.