4 ms·
But inheritance is thought to be a key to software reuse, and reusing the existing software is the safest path for inexperienced programmers to become productiv
by Koshkin 5y ago
But inheritance is thought to be a key to software reuse, and reusing the existing software is the safest path for inexperienced programmers to become productive.
- AnimalMuppet 5y agoInheritance is thought by some to be a key to software reuse. By others it is considered a huge mistake. Myself, I don't consider inheritance to be problematic when used wisely. But one shouldn't expect inexperienced programmers to act wisely. My main point, though: Don't act like the inheritance question has a consensus answer. It doesn't.
- deleted 5y ago[deleted]
- tptacek 5y agoIf this was true, it would be an argument that applies just as powerfully to Rust. Ironically: it's the argument you'd expect Java developers to deploy.
- orwin 5y agoWell... Inheritance have some use, sure. But productive code is code that is easily refactrorable, uncomplicated and easy to read. Inheriting, or rather subclassing too much will kill you code base (i'm currenctly working in a bank, writing mostly java and groovy, i think everybody agree except managment). A good alternative is composition, but you have to have a clear view of what you want. I alway try to make one function/method per action (when i have more then three indent level in a function, i'm prototyping), and that helps more than inheritance for code reuse (and i avoid comments inside functions). And i use a lot of interfaces and "default methods" to emulate "traits" which is imo superior to inheritance, in a lot of way. I still dislike java and groovy, when you spend hours depiling constructs to understand how to make a minor change on data collection, this is not a good language.