5 ms·
What problem do private fields solve?
by RandomInteger4 8y ago
What problem do private fields solve?
- jarvuschris 8y agoWhen you're building a component that will be used as part of larger applications, possibly written by other people, declaring things as private lets you cordon off internal parts of the component so that it's safer to change them in the future without breaking the applications using it Someone trying to make an application work that is looking at your classes in a debugger is going to poke at whatever inside details they can see that helps them get their job done quicker. Now if you change that their application breaks when they update. Not good for anyone. Privates make it easier for component developers to get things done without worrying about breaking users, and makes it easier for users to upgrade their components without it breaking as much
- RandomInteger4 8y agoWouldn't it be simpler to have a Terms of Service that voids the warranty of code being misused by bypassing the given API? I mean, not every software problem has to be solved with software.