3 ms·
I think inheritance is the most convenient thing which came out of OOP, but interfaces are the most valuable one. At least for business applications, you want
by DarkNova6 3y ago
I think inheritance is the most convenient thing which came out of OOP, but interfaces are the most valuable one.
At least for business applications, you want to keep your behaviour and state separate. And people following OOP dogmatically will (ab)use encapsulation for use-cases where your data should be transparent.
Contrast this to interfaces, which are essentially composable specifications on code-level (and I absolutely love that Java uses interfaces to describe anonymous classes due to the power it gives you for documentation and specification).
- rramadass 3y agoYou might find Program Development in Java: Abstraction, Specification, and Object-Oriented Design by Barbara Liskov with John Guttag interesting.
- DarkNova6 3y agoI am always a sucker for good book recommendations. Thank you!
- rramadass 3y agoThe book is by the great Barbara Liskov herself (https://en.wikipedia.org/wiki/Barbara_Liskov https://en.wikipedia.org/wiki/Barbara_Liskov) the pioneer of Abstract Data Types, Subtyping, OOD etc. It is basically a rewrite of their classic text Abstraction and Specification in Program Development (1986) with the example language now being Java. It is not a popular cookbook but a fundamental programming concepts book which needs serious study. I highly recommend it.