Loving SWT? - conclusion
For my the last entry about SWT I got some interesting comments why developers prefer SWT/JFace over Swing. Although there were many reactions for this entry, no one seems to really like SWT. Many developers argued (simplified): RCP is great, so I've to live with SWT, which is also interesting statement for new "green field" projects. Many developers converted from Swing to SWT because of performance problems in the past (which is pointless now, or at least in the Java SE 6 space). Some found JFace "refreshing" (is it positive or negative? :-)).
I prefer Swing because:
- Swing (tutorials, books, articles and screencast) is better documented, than SWT, which is extremely important in real world.
- I do not like the low level SWT-API (especially the actually undocumented bit or-ing stuff) and dispose invocations (my personal opinion - it is not an objective argument here)
- I know, that almost everything is possible (because it is not native) and extendible in Swing. I had always strange requirements, especially with tables and trees, which were not simple realizable with SWT.
...and I still do not understand the following SWT-arguments:
- Swing is too slow (I never had performance problems, or all problems were cause with slow server, bad transaction implementation, but never by the presentation tier)
- Swing does not look native (looks Eclipse natively :-))?
- SWT is easier or straight forward. (perhaps for "hello worlds" :-))
Because of the great industry support for Eclipse, I would in some cases still see advantage of using RCP (especially the existing workbench functionality). But SWT will still remain a drawback and huge disadvantage in my eyes.
...and matisse is really great :-).
I meant the "refreshing" in a positive way. I started with Swing and had quite some issues to keep my data model in sync with the UI model. That was in the early days when I started to learn Java. Later I was exposed to JFace. I really liked the possibility to let JFace "adapt" to my data model. You just need to implement some adaptors. I found this brilliant and refreshing ;-)
Perhaps with the experience I have now I wouldn't have the problems with Swing today. But back when I started Swing was somehow hard to use for me. I should definitly try how Swing "feels" today. Any good examples how I can avoid syncing the data and UI model in Swing?
Posted by Tobias on September 22, 2006 at 01:12 PM CEST #
As for the RCP, why not use NetBeans Platform? It provides similar capabilities as Eclipse RCP but is built on top of Swing. We are working on a book right now, so this should help with the documentation issues (however there are lots of new tutorials and other documents available).
Posted by Roman Strobl on September 22, 2006 at 01:20 PM CEST #
I found the opposite is true in swing. You have only to work with the model, the view will be refreshed automatically. e.g. if you change the DefaultTableModel the View will be automatically refreshed, which is really easy. It is also easy to write a custom TableModel (just extend the AbstractTableModel) and replace the default one. You should not synchronize both. This model didn't changed in swing, since the beginning. There was always a separation between the view and the model.
Posted by Adam Bien on September 22, 2006 at 08:27 PM CEST #
you are absolutely right. But I have to admit, that I haven't any real world project experience with Netbeans RCP. This will change in the near future, but this is the truth now :-). In case Netbeans RCP is comparable with Eclipse, I would prefer Netbeans. From the strategic perspective, I would prefer eclipse. Reason: it is already used as a platform by many vendors (netweaver, wsad, rsa, radrails etc.). But such arguments are project-specific and not always reasonable :-) (politics...)
Posted by Adam Bien on September 22, 2006 at 08:37 PM CEST #