Hacker News new | ask | show | jobs
by torginus 33 days ago
This is a retread of the 'animal-cat-dog' inheritance stuff we learned in our intro to OOP classes, where some people got together and put forward their own idea of programming as 'the way forward'.

And me, like others have tried structuring our code like this, and failed, assuming the fault lay not with the idea itself but our skill level. Of course, by now it's kind of common knowledge that inheritance isn't a thing that can and should be used to solve every kind of problem.

Same thing with AOP - it might be sometimes nice, but on the whole, elevating this to the language level seems to be counterproductive.

1 comments

>it's kind of common knowledge

If only.

In my experience it's mostly pushed by university professors that haven't worked in the industry since the 90s.
And thus the people who most graduates learned under, and sometimes start founding their own companies with these principles right after.
I think most university graduates from the past ~15 years are more likely to get taken in by trendy new cargo-cult fads than repeat things taught to them by dinosaurs in their boring university classes.
It took me so long to beat the following into my team: Inheritance and instantiation by default is a no-no. Use instances when state would be useful to the process, and use Inheritance when you have a lot of overlap between two processes/concepts and want to simplify/unify the code base.

Application of inheritance is a reaction to the current state of the code, not a foundation you start with.

yea it's amazing how many goofy ass "senior engineers" are still cargo-culting inheritance.