this post was submitted on 03 Jul 2023
99 points (96.3% liked)
Programming
17394 readers
765 users here now
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Rules
- Follow the programming.dev instance rules
- Keep content related to programming in some way
- If you're posting long videos try to add in some form of tldr for those who don't want to watch videos
Wormhole
Follow the wormhole through a path of communities !webdev@programming.dev
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
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.
Yeah that's a good point. It's telling that inheritance is by design difficult to change unless you follow very specific rules of good OO design patterns.
I guess it's easy to write bad code in any programming paradkgm but inheritance makes it easy to screw up.