DEV Community

Discussion on: Implementation Inheritance Is Evil

Collapse
 
lluismf profile image
Lluís Josep Martínez

Not a single example to prove your thesis. Bah!

Collapse
 
wrongabouteverything profile image
wrong-about-everything

There can not be a sufficient example. The topic is too broad. Anyway, what exactly do you want be to exemplify? I think I've made it crystal clear that implementation inheritance is bad, no?

Collapse
 
lluismf profile image
Lluís Josep Martínez

No you didn't. To prove it you must show that all cases prove your theory and it's very easy to find counter-examples (of inheritance applied correctly). It seems that you've worked with bad uses of inheritance.

As a counter-example, you can look at Hadoop project and its use of inheritance:
github.com/apache/hadoop/search?ut...

You can take any of those classes and propose a better implementation without using inheritance. It's a top quality project, good luck!

Thread Thread
 
wrongabouteverything profile image
wrong-about-everything

I didn't intend to prove that. Programming is not mathematics, there is nothing that can be proved there. But there are good and bad practices. I showed why generally implementation inheritance is bad.

In order to fix Hadoop's inheritance issues I should realize what it is about internally, and I don't. Anyway, do you think that it's just impossible to replace inheritance with composition? And who told you that Hadoop is a top-quality project?

Here is how a world without (almost) any inheritance could look like: github.com/yegor256/takes