4 ms·
Over time people will become dependant on your entire api, bugs and all. Without private methods or some equivalent you won't be able to change your library wi
by jabradoodle 3y ago
Over time people will become dependant on your entire api, bugs and all.
Without private methods or some equivalent you won't be able to change your library without breaking lots of people's code.
It also makes understanding the interface hard, if everything is public, how do I know which methods are intended for me to consume, and which are internal helpers.
Of course, not all interfaces will suit your need and some are poorly designed.
- hajile 3y agoIf they begin with an underscore, they are internal. This has been convention for decades now.
- jabradoodle 3y agoThat is fair and a trade off. That doesn't make the concept of private functions a bad one.
- hajile 3y agoModules already offer private variants and methods. The only real difference is less boilerplate, more customization, no confusing edge cases, and not allowing the inheritance footgun.