Default / package-private access
Is package-private a legitimate concept? I mean, forgive the sacrilege, but it feels like an accidental oversight that became a de facto piece of a spec out of necessity. "Hey, did you know this code compiles if you don't use private, protected, or public? Yeah, so do these other 10,000 programs. Uh, let's just write it into the spec as default behavior."
Default access is unnamed of course which is syntactically bad and counter intuitive. I'd expect default to sort out to private myself. And I'll argue that package-private is a little uglier that C++'s friend syntax. Package-private gets tangled into the file system after all.
Then there are the design trade-offs. Encapsulation spills out with default access. And any immutable contract is broken with default access. Maybe these types of contracts can be made at the package level, not sure.
So, here's the simple question to those with 10+ years of Java programming. Do you use default access deliberately to allow other objects in the same package to manipulate your object directly?
How would you rank default access: never use, use extremely cautiously and only when it makes sense, or use all the time?
Many thanks for all insight.