DEV Community

Discussion on: Implementation Inheritance Is Evil

Collapse
 
alainvanhout profile image
Alain Van Hout

I would advise not relying too much on the metaphor of biological taxonomy, since it’s based on one critical point that is at odds with what you are advocating: biological inheritance involves no abstracts, but only concretes.

Also be careful with proliferation of decorators. That way lies madness (due to unmaintainable code).

Collapse
 
wrongabouteverything profile image
wrong-about-everything

Biological inheritance involves only abstracts. Cat is abstract, dog is abstract. They both are types, or interfaces. The cat Tom is concrete, it is an object. It doesn't inherit any type, while a cat does.

I have a different perspective on decorators. They bring big amount of composable, small and hence maintainable classes which is a crucial for any object-oriented piece of software.

Collapse
 
alainvanhout profile image
Alain Van Hout

Felis silvestris is a specific gene pool, Canis familiaris is a specific gene pool. The cat Tom is a specific part of that gene pool. (It's composition all the way down, so to speak)

As for decorators (in vast amounts), if they work for you then all the better.

Thread Thread
 
wrongabouteverything profile image
wrong-about-everything

Oh, I see what you mean now. I just don't view a Cat as a gene pool. I consider it from a behavioral perspective, rather then the one from an internal state. Probably from scientifically point of view your approach makes sense, but I'm not a geneticist, I'm a developer. What I'm looking for are useful abstractions. This one works for me and for somebody else, while it might not work for you.