Java 1.5 Thoughts

So I installed Java 1.5 last night (J2SE SDK 5.0) just to be hip, cool, cutting edge and with it. My instincts as I get older are to *not* upgrade as that usually causes breakage and pain, but I figured that in order to be the tech savvy guy that I am, and not having to worry about breaking a specific project at the moment, I might as well upgrade and see what it's like.

Well, it's like a new version of Java. New stuff is new stuff, right? Though I have to say that the syntax of Java 1.5's new features are pretty damn ugly and don't help all that much IMHO. I can't believe that the word "in" was never reserved years ago, as using the : key in the new for loops is just plain non-intuitive. The Class<?> syntax is odd and the @attributes are *really* hard to parse. Like I've written about before, I would've liked to see more specific changes in how you *use* Java in this major release. Cleaning up CLASSPATH hell, automatically finding .jars, etc. They've gotten rid of using rmic, too bad we still have to use javac. We should just be able to call .java files directly if we want.

In terms of breakage, Tomcat seems to run fine, which is really the baseline for me. Hopefully JSPs will be upgraded to 5.0 sometime as I can really see a use for static imports on JSP pages. I actually wrote about this not too long ago: One of the advantages I see in PHP development is being able to easily import loads of generic use functions into pages. Though you can sort of do this with includes, it'd be *so* much nicer if there was a clean way of updating commonly used code without causing a global recompile on every JSP page you have. But right now the page directives don't support static imports, so this will have to wait. Yes, I know scriptlets are bad, but I can see how much of the pain of custom tags could be done away with a static import system like this.

I wonder when Java 1.5 will be relevant in work world? I remember that 1.4 broke so much stuff that it took me over a year before I switched to using it regularly. Because of the syntax changes, it's going to be even more of an uphill battle for this release. Not because of the code itself, but because of the learning curve. For example, when I moved to 1.4 I started using some of the new String methods right away. This caused breakage if anyone tried to run that code on a 1.3 JVM because the libraries just weren't there. But the fact is that anyone who knew Java could read that code and understand what I was doing with the new methods. With Java 1.5, there are definitely bits I don't grok yet. Start using a lot of that code in your project and you might as well be using Haskell or something... those not up to speed on the new syntax will be completely bewildered. So my point is that having organizations move wholesale to 1.5 is going to take a while for that reason. There'll always be the intellectually lazy guy who bitches and moans about moving up, and find all sorts of reasons why he shouldn't have to learn the new syntax.

An annoying part of the new Java code is the template syntax with < and > tags. Now you can't just copy/paste your code into your blog site, instead you have to spend time escaping those tags. Bleh. I know C++ uses that convention, but I think Java could've done something a bit different and clearer. And there's still tons of "redundant" lines like List<String> listOfStrings = new LinkedList<String>( ); I mean, how many times do I have to write List and String in one line to freaking tell Java what I want? I know this helps casting, but I never really had a problem with it and this seems like a band-aid, not a real fix.

Anyways, I've got O'Reilly's Java 1.5 Tiger: A Developer's Notebook subscribed in Safari and it seems to explain the new features quite well and concisely. Now that I've bitched, I just have to accept the reality that this stuff is now a permanent part of my favorite programming language and get on using it. Right?


< Previous         Next >