Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

14
  • 31
    That sounds like a post-hoc argument that some middle-level decision maker invented, maybe after a particularly traumatic failure that prevented them from properly generalizing the "lessons learnt"from that incident. Commented Dec 19, 2023 at 22:29
  • 21
    This is a case where unit tests can solve a lot of issues without those strange, arbitrary rules. Commented Dec 20, 2023 at 3:00
  • 10
    TL;DR of duplicate: both inheritance and function duplication are wrong way to handle problems like this. You need to use composition which provides reasonable balance of control, safety and code reuse (speaking from personal experience here, because I've been in situation that sounds exactly as you describe and changing inheritance to composition worked like a charm) Commented Dec 20, 2023 at 6:00
  • 1
    I think that depends on the language used. What is your project written in? Commented Dec 20, 2023 at 12:26
  • 4
    You don't always want to resuse code, but in this case if you wanted to change the basic functionality you would have to change it in 98 places. Commented Dec 20, 2023 at 23:24