3 ms·
I think we have two failed concepts in classes: inheritance and encapsulation done wrong. I don't need to explain why making excessive use of inheritance is wr
by DeathArrow 5y ago
I think we have two failed concepts in classes: inheritance and encapsulation done wrong.
I don't need to explain why making excessive use of inheritance is wrong. Encapsulation is done wrong because you end up with lots of hidden state and a very complicated dependency graph.
- crubier 5y agoIndeed, one of the pillars of OOP is encapsulation. (= encapsulation of state = hiding state = every object can maybe be stateful, but you can't know from the outside). Meanwhile, one of the pillars of modern programming techniques (FP, React, and others) is to make state very explicit and separated from the rest (Think State Monad, react's useState, etc), because statefulness is now correctly identified as being a major source of problems. So OOP took us completely in the wrong direction regarding state management, for 2 decades... Understanding in 2014 that was liberating for me.