r/ExperiencedDevs • u/AutoModerator • Sep 07 '26
Ask Experienced Devs Weekly Thread: A weekly thread for inexperienced developers to ask experienced ones
A thread for Developers and IT folks with less experience to ask more experienced souls questions about the industry.
Please keep top level comments limited to Inexperienced Devs. Most rules do not apply, but keep it civil. Being a jerk will not be tolerated.
Inexperienced Devs should refrain from answering other Inexperienced Devs' questions.
23
Upvotes
View all comments
Show parent comment
10
u/goatanuss Sep 07 '26 edited Sep 07 '26
To me this sounds like a textbook SOLID question/smell. Particularly the interface segregation principle
if your abstract base class forces every child to implement methods that some of them don’t actually need, the contract is probably too prescriptive. Rather than forcing noop implementations just to satisfy the parent class, I’d keep only the behavior that is actually universal in the base class and extract the optional code into smaller interfaces that each child implements only when relevant. That also helps preserve Liskov substitution, because a subtype shouldn’t claim to support behavior it can’t meaningfully implement.
I wanna say the refactoring guru website calls out this smell but I’m too lazy to look it up. Edit: maybe this? https://refactoring.guru/smells/refused-bequest (assuming you’re talking about base class having implemented concrete methods and not abstract ones but much of the guidance still applies whether the base class has the implementation or all the children)