3 ms·
I have always associated classes with inheritance. Perhaps there are other scenarios where classes are unrelated to inheritance. I don't know as I intentional
by austincheney 7y ago
I have always associated classes with inheritance. Perhaps there are other scenarios where classes are unrelated to inheritance. I don't know as I intentionally avoid classes all together.
I avoid inheritance because inheritance increases complexity. By complexity I simply mean it in terms of complicate, or to make many. I am not speaking to anything related to challenges, easiness, or hardships. Inheritance is a practice of a concept called polyinstantiation, which allows easy dynamic replication of an object in memory so that many child or cloned objects are independently extensible.
* https://en.wikipedia.org/wiki/Polyinstantiation https://en.wikipedia.org/wiki/Polyinstantiation
* https://en.wikipedia.org/wiki/Complexity https://en.wikipedia.org/wiki/Complexity
- croo 7y agoIt's better to associate classes with encapsulation. I generally don't do inheritance apart from a few weird cases because composition over inheritance works way better.
- westoncb 7y ago> I have always associated classes with inheritance. This is a common pattern I've noticed in discussions about OOP. There is a tendency to reduce it to "inheritance," which turns the conversation into a straw man: "here is why inheritance is bad, therefore OOP is bad". Same goes for identifying classes with inheritance. Their primary feature is grouping of methods and fields into (potentially) encapsulated units, and being a mechanism for abstraction: classes are more general than their instances and serve as a general pattern; upon construction they are 'configured' through parameters to their constructors and particular forms are arrived at.