4 ms·
I have to say, for me private methods and fields are not a security thing. They are a way to keep the public interface clean and only confront the user with the
by Tichy 16y ago
I have to say, for me private methods and fields are not a security thing. They are a way to keep the public interface clean and only confront the user with the information they need.
- someone_here 16y agoAnd that's the problem.
- Tichy 16y agoWhy? It conveys a piece of information. Would you feel better about it if instead of writing "private" in front of it, I would write a comment "it is probably a bad idea to use this method in your own code"? What would be the gain - it is simply more verbose?
- uxp 16y agoThere is no reason to use a private/protected method. If the library/class you are using doesn't fulfill the qualifications you want, expand the library, not the code that uses the library.
- snorkel 16y agoNot just for cleanliness but more importantly change protection: denying direct access to the internals assures that you can rewrite those internals and not break any external dependencies.
- yason 16y agoI thought Java had interfaces for public APIs?