Swing and AWT, argh
Posted May 19, 2006 23:18 UTC (Fri) by
man_ls (subscriber, #15091)
Parent article:
Harmony project to get a Swing/AWT implementation
Sun controls the Java specification. This means that they can say what is Java and what not; this power came in handy to stop Microsoft from subverting the language (and earn a lot of money in the process). But, as the linked post says, the spec contains the brain-dead AWT and the doubly brain-dead Swing. Let me rant a little.
Many Java libraries should have been optional; having Swing support on a machine without X Window is not very useful. But no, everything went into the spec and everything had to be there. This is not about Microsoft adding its own classes into the mix, but about people removing what they don't need. Sun wanted to have everything there, always, so developers could depend on the features at runtime. But this is hardly useful most of the time; having java.sql on a machine without an installed database is not going to help.
The Abstract Windowing Toolkit or AWT was an attempt to make a graphical environment that could be used on any system. Sadly, it was very limited in scope; in its day multi-platform graphical toolkits were still beginning to take shape. (Remember when it was cool to run an "applet" within your browser?) Very soon Sun wanted to add new functionality, but the need to maintain backwards compatibility made it difficult. Around 1999 and the misleadingly called Java 2 (officially it was 1.2), Sun engineers came up with an utterly stupid solution which solved a problem that nobody had. The all-Java (or pure Java in Sun parlance) graphical toolkit was built on top of AWT: with it the interface could sport a Windows look-and-feel on Solaris and viceversa. Very useful. In the process they created a slow, highly bloated environment and a memory hog, which needed endless optimizations to be barely useful. By the way, all look-and-feels were ugly. This monstrosity was called Swing.
So now we are stuck with it forever. In fact, gcj and GNU Classpath are mostly complete except for AWT and Swing. Meanwhile, IBM (and later the Eclipse project) found the time to build a much lighter and faster environment, called Standard Widget Toolkit or SWT. It uses the novel (yeah, right) idea of using platform-specific code internally to display controls, and still presenting a uniform API. It's good stuff. The bad news is: even if you only want to use SWT applications, you still have to carry the burden of Swing.
This latest addition to Harmony must therefore be useful to some people. I cannot figure out why did Intel have a Swing/AWT implementation to donate, but I guess we will find out soon.
(
Log in to post comments)