this post was submitted on 10 Oct 2024
45 points (84.6% liked)

Programming

17195 readers
322 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 [email protected]



founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[โ€“] [email protected] 3 points 6 days ago* (last edited 6 days ago) (1 children)

is very hard to create a good inheritance structure that does not devolve over time as new requirements get added

That's such an important point. Whatever else folks take from this thread, I hope they catch that.

And I'll pile on to add - more layers is more risk. One layer of inheritance is a lot easier to keep maintaining than inheritance that goes four layers deep.

[โ€“] [email protected] 2 points 6 days ago

And if you only have one layer then why not just use interfaces/traits? Which are a vastly better design than inheritance.