3 ms·
> "private" does not add anything new to a property. If you don't want the > property to be used outside of the class ... don't use the property outside > of th
by recursive 15y ago
> "private" does not add anything new to a property. If you don't want the
> property to be used outside of the class ... don't use the property outside
> of the class.
I think the author missed the point of private, because it does add something new. Specifically, it adds the ability to know that the property is not being altered outside the class without reading the entire code base.
- prodigal_erik 15y agoNot even reviewing the code can prove that any property is inaccessible, when its name could be constructed anywhere at runtime and used via object[propName]. Without actual language and runtime enforcement, there are almost no pervasive changes safe enough to make without the kind of thorough regression testing most teams aren't prepared to do. Which is not to say they don't do it anyway, and sometimes get lucky.