Most of us have bad memories of over-complex hierarchies we regret seeing, but this is probably due to the dominance of OOP in recent decades.
This sentence here is why inheritance gets a bad reputation, rightly or wrongly. Inheritance sounds intuitive when you’re inheriting Vehicle in your Bicycle class, but it falls apart when dealing with more abstract ideas. Thus, it’s not immediately clear when and why you should use inheritance, and it soon becomes a tangled mess.
Thus, OO programs can easily fall into a trap of organizing code into false hierarchies. And those hierarchies may not make sense from developer to developer who is reading the code.
I’m not a fan of OO programming, but I do think it can occasionally be a useful tool.
Lots of people equate OOP with inheritance, and I think that does a disservice to OOP code style in general. The original definitions of OOP had nothing to do with inheritance at all and this relationship was only popularized by a few languages (which others then copied due to aggressive marketing).
IMO the more important parts of OOP that are still useful are encapsulation and message passing which can be done in languages without inheritance.
I would caution against throwing out a paradigm before of one aspect of of that languages added onto it after the fact.
This sentence here is why inheritance gets a bad reputation, rightly or wrongly. Inheritance sounds intuitive when you’re inheriting
Vehicle
in yourBicycle
class, but it falls apart when dealing with more abstract ideas. Thus, it’s not immediately clear when and why you should use inheritance, and it soon becomes a tangled mess.Thus, OO programs can easily fall into a trap of organizing code into false hierarchies. And those hierarchies may not make sense from developer to developer who is reading the code.
I’m not a fan of OO programming, but I do think it can occasionally be a useful tool.
I think part of the problem isn’t just bad hierarchies, it is that they are so hard to fix.
Bad OOP code gets its fingers everywhere, and tearing out a bad hierarchy can be downright impossible.
Lots of people equate OOP with inheritance, and I think that does a disservice to OOP code style in general. The original definitions of OOP had nothing to do with inheritance at all and this relationship was only popularized by a few languages (which others then copied due to aggressive marketing).
IMO the more important parts of OOP that are still useful are encapsulation and message passing which can be done in languages without inheritance.
I would caution against throwing out a paradigm before of one aspect of of that languages added onto it after the fact.