|
Re: Java: Evolutionary Dead End
|
Posted: Jan 4, 2008 2:32 AM
|
|
> Now it's a monster. The size of the JLS has increased a great deal. > It kind of eliminates one of the big reasons to use Java. > There are a lot of equally (and maybe even less) > complex languages that offer a lot of useful things that > Java lacks. Without the simplicity, there's not a lot of > reason to continue using Java, especially when there are > languages like Scala that allow us to continue to use our > existing Java code and the vast array of libraries for > Java.
I think one of the best examples where Java is unnecessary complex are primitive values. I can't put an int into a List, so I have to convert it to an Integer - which is now accomplished automagically by autoboxing. But an Integer can be null, an int can't, is that also somehow affected by autoboxing?
Scala is much less complex there: Int and int are the same, both compile to Java's int and all operations are actually methods of Int, but can be written as normal operations because Scala allows method calls as infix syntax.
About the uglier generic definitions, consider this example:
Map<String, List<Integer>> entries = new HashMap();
Now, the compiler gives me a warning and to fix it I'd have to repeat the generic definition:
Map<String, List<Integer>> entries = new HashMap<String, List<Integer>>();
I think that warning is completely pointless, redudant. And duplicate code. I doesn't matter if I use HashMap without a generic type or with, the result is the same: Map<String, List<Integer>>, and thats all what matters.
My solution to the problem: Turn of warnings about unsafe generic blabla operations in my Eclipse IDE, and telling coworkers to do so, too.
I'd welcome if that warning is fixed, so that it warns me about using Map without the generic type.
|
|