For an article aimed at juniors to understand good arguments about these concepts I wish it was better thought out.
For example interfaces can be extremely bad when they are overused and make a codebase hard to navigate because understanding what concretely exists can sometimes only be figured out at runtime. Dynamic languages suffer from this as well because duck typing becomes a freeform interface.
The argument against inheritence could also be stronger. The example seems contrived and even with a small bit of thought you can see other ways of laying out data other than just newing every element. Inheritance largely doesn't mandate a data layout and there should really be mention of dynamic dispatch as another negative in the example as well!
Where inheritance does go wrong more commonly is in deep inheritence hierachies where the modelling approach not only makes functionality hard to understand because it'd smeared over multiple classes but leads to functionality getting pushed down so different trees can share it leading to bloat across every object in the hierarchy that has access to functionality it then might not need. Classic OOP game hierarchies like UObject and AActor in Unreal typify this.
meheleventyone•27m ago
For example interfaces can be extremely bad when they are overused and make a codebase hard to navigate because understanding what concretely exists can sometimes only be figured out at runtime. Dynamic languages suffer from this as well because duck typing becomes a freeform interface.
The argument against inheritence could also be stronger. The example seems contrived and even with a small bit of thought you can see other ways of laying out data other than just newing every element. Inheritance largely doesn't mandate a data layout and there should really be mention of dynamic dispatch as another negative in the example as well!
Where inheritance does go wrong more commonly is in deep inheritence hierachies where the modelling approach not only makes functionality hard to understand because it'd smeared over multiple classes but leads to functionality getting pushed down so different trees can share it leading to bloat across every object in the hierarchy that has access to functionality it then might not need. Classic OOP game hierarchies like UObject and AActor in Unreal typify this.