Too Little Opportunity for Class Extension
I have been working in the OO world for more than 15 years and am an expert in Smalltalk. I have begun moving into Java and am not entirely thrilled by my experiences to date. I am finding out that what I would treat as simple tasks prove to be inordinately difficult or end up incomplete in Java. This is because of the implementation and not the general design of the classes.
My task was to write an INI file parser that correctly handled sections, using the more or less standard MS convention. It seemed that extending Properties would be an obvious approach, but as it turns out, there is very little extension you can do. Almost all of the data members and utility methods are private, which means they cannot be inherited by a subclass. I had to duplicate over 75% of the implementation just to handle the I/O changes, where I could have inherited most of it.
This is not the only case where this problem manifests -- consider the implementation of PrintStream. The constructors create writers / streams and store them into two private fields. Consequently, it is impossible to extend the class in order to build an encoded print stream class, where the constructors specify the encoding. As a case in point, this situation shows up in the Properties class, where contains a bit of extra programming that would have been unnecessary if an explicit coding were available when creating a print stream.
In general, a member field or method should be private if and only if it represents a fundamental characteristic of the implementation that would cause behavior of extended classes to fail unless other methods were also changed. The use of protected members should be preferred in 90% or more of the cases I have seen in examining the code. A less optimal way would be use to force the issue by inhibiting extension in such cases through declaring the class final. Then again, perhaps adding a language statement for derived classes to explicitly hide protected or public fields and methods would be useful alternative.

