7 Java Irritants
Java is a pretty robust language for the objectives it seems to set itself - being a clean and easy-to-learn object-oriented language - although the slippery slope towards featuritis is very apparent in 5.0. The automatic garbage collection, in particular, is a godsend for someone migrating from C++.
But there are still plenty of little niggles that could be rectified:
-
Make the structure of the program dependent on indentation, like Python, and get rid of the curly braces everywhere. It makes sense.
-
Get rid of the primitive data types (int, long, etc.) at the source level. Auto-boxing in Java 5.0 makes them less annoying, but they still aren’t necessary - the lack of a primitive string datatype makes that clear.
-
Have an explicit modifier for package-private/friendly visibility, for consistency, and make it mandatory to specify a visibility modifier. These things make the code less ambiguous for those unfamiliar with the rules.
-
Remove the one-class-per-source-file restriction (in theory this is for public classes only, but because of this, most people use a separate file for each class). It makes for huge and unwieldy build and deployment structures. C++ shows how it can be done.
-
Get rid of the syntatic inconsistency between interfaces and classes. Methods in interfaces are always abstract as they cannot have a body. Java allows the _abstract _modifier to be missed out, however. This can be confusing.
-
Make
/* */
-style comments nestable. It is very irritating to comment out a block, but have to do it in bits because of a ‘real’ comment block that’s part of the code. Colour-coding text editors mean that there shouldn’t be any confusion when doing this. It would also make//
-style comments largely redundant. -
Merge the concepts of list and arrays, as Perl does. This allows for a far greater degree of expression in the language, and reduces some of the OO waffle necessary in Java when dealing with lists.
This kind of stuff is almost always about personal preference, so it’s unlikely that you’ll agree with all of the above. But I’d love to hear your comments anyway. What little things annoy you about Java?
Comments