Java 5 Features Provoke Dissent
The release of Java 5 was widely hailed by Sun and through the tech world, but one programmer sees evidence of ‘feature creep’ posing problems for Java coders.
Shai Almog has a list of Java 5 features that caused him to declare the changes made to the language are something of a failure.
In his blog post about the Java 5 language, Almog discussed features and the issues they can pose to the diligent programmer. He has received some pushback from posters at the JavaLobby forums over his assessment that features add complexity:
He stated several points that drew criticism from other Java coders, going so far as to (humorously, we hope) call him a COBOL programmer. From Almog’s list:
- Generics – bad implementation that does not maintain type safety, exact same thing as a cast, odd syntax for polymorphism, introduced warnings instead of errors, redundant.
- Enums – Enums were denied from the original Java programming language because they are unnecessary and encourage bad code in many cases. There is one use case where Enum’s have an advantage over other object oriented solutions and that is in embedded systems where the class size matters.
- Static imports – breaks encapsulation and forces people to search in yet another place for every unidentified value within a class. No real purpose other than verbosity.
- New for loop – again syntax sugar for something that could be done for the regular loop.
- Autoboxing – a huge source for bugs and essentially hides what is happening under the hood. People might expect primitive speeds and be surprised when they get 20x times the speed with a plain array.
Annotations did find favor with Almog, who wrote, “Annotations are the only Java 5 feature to produce REAL value!”
Within the various responses to his post, Almog cited the reason for posting about these issues again:
One person who disagreed pointed out that the changes in Java 5 have made the code cleaner, and that Java needs these changes to remain relevant to programmers. Another considered Almog’s points as straw-man arguments, stated as absolutes when they are actually grey areas in Java 5.
David Utter is a staff writer for WebProNews covering technology and business.