Wednesday, October 05, 2005

Mustang is comming, it's time to face the Tiger

So you have been waiting patiently for the the dust settle, the bugs to rear their ugly heads and get squashed, the PR machine to choke on it's own shite and die, the {tech articles, books, and blogs} written, your favorite IDE to support it and finally the name of the damn thing to stabilize.

Aside:

Since I've milked all the humor I can out of Sun's marketing fiasco with the naming of the Tiger release I'm going to put it to rest and refer to Tiger either as Tiger or Java 1.5. No more snide remarks and no more conspiracy theories about the marketing department's Pinky and the Brain like attempt to rule the world by creating mass panic and confusion across the land by first naming it 1.5 then changing it to 5.0. Causing the masses to think some unknown quantity of time had mysteriously evaporated between the transition from 1.5 to 5.0, a jump of 3.5 releases almost instantaneously. The Brain, err ...Sun would then step in explaining that the earth had passed through a worm hole and during the lost time Bill/Microsoft had been defeated by Scott/Sun and Sun was now the 800lb gorilla thus all is well and proves once and for all that Stanford graduates are smarter than Harvard drop-outs.

So guess what? ..... It's all come to pass and it's time to upgrade to Tiger. There is absolutely no reason to be a holdout. There is just too many goodies in it not to risk the move. But, if all you have to go on is the what Sun's PR machine had been churning out you might think the only thing good in Tiger is:

  1. autoboxing
  2. varags
  3. annotations
  4. static imports
  5. type-safe enums
  6. enhanced for loop

Rant:

I was going to include generics in my list but I decided against it. The list as it exists, reflect the so called simplification of Java features and anyone that thinks Java's generics implementation is a simplification is a complete moron. The fact that for anything but the simplest case you have to redeclare the inheritance hierarchy to use it says it all. I'm not even going to spit venom on the fact that it's impossible to create a generic array or how all that wonderful generic type information that they force you to finger fu*k into your source code (have you seen the syntax? Nuff said!) suddenly disappears at runtime. But I'm not bitter!

Though as far as I'm concerned the only thing worthwhile on that list is 5 and 6. So now that we have gotten pass "the reasons for VB programmers to jump to Java" lets talk about the stuff that's important to me.

Firstly they went back and tuned up the memory model. This to me is the most important thing that Sun got right in Tiger because it solves once and for all the inconsistencies related to multi threaded programming in Java and if you are a reader of my blog you ought to know how important a topic I think multi threaded programming is.

They gave us java.util.concurrent, java.util.concurrent.atomic, and java.util.concurrent.locks. These three packages combine to make it possible to write scalable multi threaded applications. There is enough there to act as the foundation for frameworks designed to simplify the task of writing multi threaded programs (i.ei.e. CSP) but abstractions can and do leak so it's important to know how all this stuff really works so that when something goes wrong you won't be sitting around with your thumb up your butt because you haven't the slightest clue of how things work under the covers.

Uncontended synchronization is cheap. It's so cheap that even though I am an advocate for java.util.concurrent I still use synchronized in some places. But I'm not entirely being fair to synchronized. It does have other benefits beside locking. It also enforces ordering, so it still plays an important role where execution ordering is important. Then again .... the ordering that synchronized provides can be achieved without using the synchronized keyword thanks to the additional semantics of the volatile keyword imposed by the updated memory model.

Finally, they have continued to improve object allocation performance. As a matter of fact, creating a new object is damned cheap especially if the heap is big enough. Object deallocation has also improved. In some cases it's free (more on this later).

So now the Java engineers over at Sun are working on Mustang (J2SE 1.6). This version is being billed as the desktop release and you are going to hear all about the cool new desktop features. So if you are GUI/AWT/Swing programmer there should be enough in there to get you moist maybe even wet. Given that I haven't written a Java GUI since I first learned Java and I don't plan on writing any anytime soon, I'm going to have to a take Sun's word for it . But there other things in Mustang that floats my boat. The most interesting one is that I can hack on it have my work included as part of the J2SE public release.

Aside:

I have mixed feelings about this. Firstly, I love Java so getting a direct hand in improving what I think is wrong with it and being able to share that with all the other bean-slingers is very appealing. But on the other hand, I'm not a big fan of Sun Microsystems, specifically their management staff (McNeally should be fired) and the stuff that comes out of their collective mouths. Talk about a confused message. They have put their foot in their mouths, McNeally and Schwartz especially, too many times for me to feel great about working for Sun for free because no matter what I do it will ultimately belong to Sun. Whenever they do something I agree with I can't help feeling it happened by accident or it was because the market forced them to and not because they had the foresight to do the right thing, i.e. OpenOffice.

But that's not all. One of the more encouraging things about Java is that Java the platform (JVM to be specific) continues to improve and remains at the center of a lot of research. That trend continues in Mustang. Read this. It was reading this that triggered my writing this entry in the first place. On the library side of things java.util.concurrent will sport a new ConcurrentMap built on a relatively new datastructure called skiplist. Though the jury is still out on whether skiplists are better (speed/memory) than B-Tree datastructrues like Red-Black Trees (i.e. java.util.TreeMap) and AVL trees. There are a couple of worthy JSRs that may make it into Mustang, the most worthy being this.

All in all Tiger and Mustang have a lot to offer programmers so if you are still a holdout it's time to let go and take the plunge.