Around this, there are a few subtle lines with which I could answer in several different ways.
Consider the case where the developer marks almost everything as personal. Perhaps this was a great class that could be reused if I could extend it and override the doSomething() method. However, since the method was marked as personal, my hands are tied. This will force many developers to copy and paste the entire class, changing one necessary part. (Not cool.) So you can see that labeling everything as private prevents reuse.
However, on the other hand, consider the case where the developer marks everything as public. The developer or other developers begin to write extension classes or call all the various methods / access to attributes, which may need to be marked as protected / private. A design error was found, or one that requires the class to be changed. However, since it was written so “openly,” it may have been a simple solution, now much more complicated, since all additional links must be found and reviewed.
I think the best option is a compromise. Mark those that are intended to be used by client code as "public." Note those things that do not have a business that are expanding / redefined as "private". If there is something that might prove useful to someone in the future, it should be designated as “protected.” And always add Javadocs for further notification of your intentions.
source share