Hacker News new | ask | show | jobs
by _old_dude_ 1754 days ago
OOP is great when you write APIs/libraries (your examples), but is useless or even counter productive when writing applications, where encapsulation or inheritance just obfuscate everything.

My main grip with Java is that everything is by default a library.

But there is hope, recent changes in Java, records and pattern matching move away from that idea.

1 comments

saying OOP is only useless and counter productive is as short sighted as saying it is the golden hammer for everything.

PS: WinUI apps use plenty OOP

It's not what i've said, OOP is great for creating APIs like WinUI, not great for writing applications
In which universe an application which uses mainly OOP APIs isn't itself OO.
What OOP is good at is maintenance over the time by making clear what is API and what is implementation.

My point is that when you develop an application, you only need strawman OOP i.e. calling methods.

You don't need class inheritance if you can pass functions as parameters, you don't need encapsulation given all your pieces co-evolve at the same time (if it's not split than part into a library).

and WinUI apps are applications, and - as said - OOP is used by them, see e.g. the reference architecture guide