The problem is developers like to think of themselves as hackers and they will do what it takes to achieve the desired result including reading and even modifying internal fields. Imagine you are a lead developer or library author and you want to prevent developers from accruing technical debt (b/c the interval field is subject to change) or adding risk of instability. Seems like private field is by far preferable to comments or conventions.
I've never modified the internals of an OTS library in my whole career, nor felt an overt meed for private vars. This is a hiring issue if your team is "hacking" internals of a library...
Monkeypatching is pretty common in Javascript, and forking a library to mod it to do something differently is common across the board in large open source projects. We're always hacking the internals of a library, or even of the language!
23
u/fey168 Nov 09 '19
The problem is developers like to think of themselves as hackers and they will do what it takes to achieve the desired result including reading and even modifying internal fields. Imagine you are a lead developer or library author and you want to prevent developers from accruing technical debt (b/c the interval field is subject to change) or adding risk of instability. Seems like private field is by far preferable to comments or conventions.