3 ms·
Nowadays OO is seen as a mistake. Interfaces are much better. What's the difference? It's this: no inheritance. Still, with interfaces your complaints remai
by cryptonector 3y ago
Nowadays OO is seen as a mistake.
Interfaces are much better. What's the difference? It's this: no inheritance.
Still, with interfaces your complaints remain unsatisfied. But add generic functions and then you can have the mix of OO-like and not-OO-like APIs you have in mind.
- iraqmtpizza 3y agoI don't want to imagine something like gson or sun.tools.tree without inheritance. That would be a disaster. Composition? AssignShiftLeftExpression has-a AssignOpExpression which has-a BinaryAssignExpression which has-a BinaryExpression which has-a UnaryExpression which has-a Expression which has-a Node? return this.assignOpExpression.binaryAssignExpression.binaryExpression.unaryExpression.expression.node.op; or return this.op
- cryptonector 3y agoYou want "sum types", aka "algebraic types".
- iraqmtpizza 3y agoI don't want them; you want them.
- cryptonector 3y agoHeh, it's a manner of speaking. As in "the solution is to use sum types". Obviously i can't make you want that.