* On Thu, Feb 19 2009, Ovid wrote:
> Java programmers learned long ago not to let people touch their
> privates, Perl programmers should learn the same thing.

This is one of Java's worst design decisions.

A while back, I needed to customize the way URLConnection worked.  The
parts I needed to touch were private, so I had to copy the source files
from the open source java implementation, modify one line, and use my
"custom" library instead of the one bundled with the JVM.  All because
they said "private" instead of "public", and the runtime insisted on
enforcing that restriction.  (Sure, they could change the implementation
out from under me.  I am willing to take that risk.  The point is that
it should be *my* decision, not the module author's decision.)

In general, you should make it clear that internals are "at your own
risk", but you shouldn't physically prevent access.  It just wastes
everyone's time, and doesn't make any code more maintainable.  (Since
I'll just have to cut-n-paste to work around it.)

In general, whenever Java does something, you actually want the
opposite.  This case is no exception.

Regards,
Jonathan Rockway

--
print just => another => perl => hacker => if $,=$"

Reply via email to