Now blogging at diego's weblog. See you over there!

swt and swing, cont'd.

Yesterday Russ was ranting (his term :)) on how Sun was botching it by not getting behind SWT, because SWT is, in his view, better than Swing. I have written about both a few times before, more recently in this short review of my initial impressions of developing with SWT, and earlier here, here and here among others. Specifically on what Russ is saying I had a couple of things to add. One is that, although I'm obviously partial on this :), I think that clevercactus shows that Swing interfaces need not feel out of place, or be slow, or whatever. And I think it looks better than LimeWire too :). IDEA is also a fine example IMO. However, it's true that all of that is subjective and that for hard-core Windows users there are small differences. For power users in particular the differences might indeed be difficult to accept. The situation is much better in other platforms though.

That aside, there is the other matter that Russ mentions, that of Sun not joining the Eclipse consortium. The main reason given for this is that, for all its platform appeal Eclipse is still, at heart, an IDE toolkit. If you doubt that's true, spend some time perusing the Eclipse APIs, and you'll notice how many times you have to use components from within the IDE package rather than "platform" packages (e.g., "org.eclipse.swt"). Restated, what I mean is that the boundaries between platform and IDE APIs are not clear at all, and I guess that some people would say that's precisely the point, Eclipse is both an IDE and a platform, and that's fine. Fine indeed, but what does that matter? Well, keep in mind that Sun has NetBeans to take care of. With its own community, and plugins, and additional tools, and so on. Were Sun to ditch NetBeans in favor of Eclipse as a platform, they would have to a) port all sorts of plugins and code to the new platform, not to mention "convert" their community, both of open source developers and third party developers, to Eclipse. This is by no means impossible, but it's not easy either.

Then there is the small matter of SWT. If Sun joined Eclipse, SWT would have to be included in the JDK would it not? Sun would have to maintain and release simultaneously three different windowing toolkits for each release: AWT, Swing, and SWT. That doesn't sound good either. And while I like some things of SWT, ditching Swing completely is to me not an option.


First, Swing does run on every single platform that the full JDK runs on. For example, some users today are running clevercactus on OS/2. That would be impossible if cc was written in SWT.

Second, Swing is, for all its complexity (or perhaps because of it) and incredibly rich and flexible toolkit. Much more so than SWT. Surely this will change as SWT evolves, but that's the reality at the moment. With SWT you are forced to write custom components more often than with Swing, as I discovered when I worked for about a week replicating the clevercactus UI using SWT.

And, finally (although this is a small matter compared to the two above), SWT still requires release of resources "by hand". I find this a horrible step back. Moreover, debugging becomes more difficult. Something might fail not just on your java code, not just on the SWT-to-Native code (say, if you're running it on Windows), but something might also fail at the Native component level. Suddenly bugs have to be tracked on three levels. SWT will be buggy for a while, particularly on non-Win32 platforms (Win32 support is pretty good). And Native errors are very difficult to pin down.

Please note, these are not reasons why "Swing is better than SWT" but reasons why I think Swing can't be discarded at the moment and for some time to come. And that puts Sun in a difficult position.

Ideally, yes, Sun would join Eclipse, ditch AWT in favor of SWT keeping the latter as an alternative to Swing, plus using something like the SWTSwing project to bridge between both worlds. But for the moment, staying out of Eclipse might have been a good choice by Sun to avoid creating even more confusion.

Update: more news today on Sun's efforts regarding standarization on the non-Eclipse side of development tools.

Posted by diego on January 6 2004 at 12:40 PM

Copyright © Diego Doval 2002-2011.
Powered by
Movable Type 4.37