Wednesday, February 02, 2005

J2SE 5.0

I've just finished the first day at the Web Services on Wall Street conference. It's been interesting and strangely enough, probably the most interesting presentation was on J2SE 5.0 (Tiger). I have to admit that I haven't had time to look at this stuff since the previews I saw at last year's JavaOne. So it was good to get an overview of what Sun think are the most important changes to the language since the first version.

Generics (templates to you and me) have been coming for a while and not before time. I've used templates in C++ a lot and although I've always found them useful, they were probably one of the most un-portable features of the language I ever came across. Things have probably changed now though.

Autoboxing seems like a nice-to-have though not critical; keeps the language tidy (although maybe it's one step closer to allowing us to have operator overloading ;-). Same for the enhanced for loop and static imports.

Now type safe enums are cool. I've put up with integers in code since the first time I used Java and it really annoyed me that there was no natural way to do enumeration types. But what they've done in J2SE 5.0 with enums does seem to go one better than C++ and allow me to add functionality within an enum. This looks very interesting.

Ah varargs :-). What more can I say? At last!

Metadata looks like it could be very useful too. Certainly the presenter indicated that Sun intend to use this feature more and more as the language evolves.

Then they've added other things like printf/scanf. Nice and useful. However, as a whole, not good enough IMO. Java has always fallen short of C++ on I/O routines. You just have to look at the things you can do with cout and cin to see what I mean.

Anyway, all in all J2SE 5.0 looks like it could be a good addition to the Java family. Sun reckon that you could get 20% performance improvement just by running old code on it. I'll wait and see on that one. But I do wish I spent more of my time programming so I could find out. Oh well. Maybe next vacation!

No comments: