4 ms·
I get your sentiment of the overused "hidden"/"private" stuff that seems like people following some sort of decades-old ritual and then adding getter/setter, wh
by valand 7y ago
I get your sentiment of the overused "hidden"/"private" stuff that seems like people following some sort of decades-old ritual and then adding getter/setter, where it should have been all transparent, knowingly that the module/package will eventually be running in a single process.
"private"/"hidden" attrs/methods help limiting the knowledge needed by new developers jumping into and building on top of existing code base.
Concealing complexity is necessary, but can be done with other methods such as HOF, selective exports, etc.
This is called interface-first design paradigm where your module is "serving" other module by doing its job without exposing its complexity.
Disclaimer: I'm mostly use TypeScript in a functional/data oriented design manner. Not a big fan of OOP.