www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.dwt - SWT, AWT, Swing, QT...

reply Matthias Spycher <matthias coware.com> writes:
I'm not an expert UI designer, but I've had the opportunity to work in 
groups that use (or have used) all the mentioned toolkits. It's very 
difficult to make a decision based on technical merit alone. QT is great 
for high-performance static apps (not much dynamism/configurability at 
runtime). The Java toolkits are quite good in the more dynamic 
environment of a JRE (reflecting the smalltalk heritage). I would argue 
that AWT/Swing and SWT will continue to benefit from the competition on 
the Java platform. The SWT/JFace combo in eclipse demonstrate that you 
can build very large sophisticated apps in Java. Performance is not as 
good as QT,  but it is sufficient for many apps. Take a look at IBM's 
Workplace Client technology for example:

http://www-128.ibm.com/developerworks/workplace/products/clienttechnology/

I vote for DWT, not for technical reasons, but because it's a good 
business decision. I very much agree with Shawn Liu's assessment of the 
benefits of "getting close" to the eclipse ecosystem. SWT -> DWT may be 
just a launch pad for something much bigger. Anyone who has used eclipse 
with EMF and GEF knows where this train is heading. The model-driven 
architecture (MDA), where most of an application's code is generated, is 
becoming a reality. And if D can ride this wave, it has a much better 
chance of survival.

Matthias
Feb 07 2006
next sibling parent reply "Shawn Liu" <shawn666.liu gmail.com> writes:
Frankly speaking, I'm not a GUI expert neither, but a fan, and spend a lot 
of time on it. I began to learn java at the beginning of 2004. Attracted by 
Eclipse and SWT (but don't like the VM of java).  At the end of 2004, I 
firstly encountered D by chance. Wow, like the words in main page of D, 
"Great, just what I need.. ". But seems there wasn't a very powerful GUI 
library for then. I tried to pick up DWT on Dsource.org and made some 
attempts in 2005. So far the DWT win32 reaches v0.35.


A well designed GUI library is important especially for a system language, 
since it is used more in desktop than in server side. Where were many argues 
about cross-platform GUI library and many available libraries.
http://freshmeat.net/articles/view/928
http://www.brayden.org/twiki/bin/view/Software/GuiToolkits
http://www.cuj.com/link/subject36.htm?topic=link


There are mainly 3 approaches to make a cross platform gui library, 
distinguished by heavyweight/lightweight or native primitive/emulation.

1) lightweigh and fully emulation
 a top level window is native primitive as a container and any other widgets 
are emulated by "drawing". In win32, only the top-level window wrap the 
HWND.
 java SWING is such a toolkit, and some SDL/OpenGL based library, and Andrew 
Fedoniouk's "Harmonia"
 http://www.terrainformatica.com/wiki/pmwiki.php?pagename=Harmonia.Harmonia
 Seems that google's picasa2 uses such library
 http://www.google.com/picasa/

 pro : Easy to implement rendering, texture, zoom, skin etc. since there is 
a graphics engine under the GUI toolkit. Java2D is such a easy to use thing. 
The maintenance is not heavy.

con: may different look-n-feel from the native app. Some application can not 
work with it. For example, an on screen dictionary application. Try as 
possible to emulate the native widgets and theme is not easy and may cause 
performance issue. Open File Dialog in SWING is such a thing. Font in picasa 
sometimes seems not clear and sharp enough.


2) heavyweight and emulation
 widgets are native primitive but don't use the controls provide by platform 
and emulate the behaviors. In win32, behind every widget there is a HWND.
 QT and FoxGUI http://www.fox-toolkit.org/ are such libraries.
 google earth is written using QT
 http://earth.google.com/

 pro: height performance as native widgets. maintain the source in a high 
level.

 con: look-n-feel still different from native app.

3) heavyweiht and use native widget as possible
 SWT and wxWidget are such toolkits.

 pro: native look-n-feel, themes by the platform, high performance. Upgrade 
with the system.

 con: maintain the source for different platform is a heavy burden. Still 
need emulate some widget in some platform.


We can see every approach has its benefit and drawbacks.

To D, if we make a GUI library from ground, I'd agree to Andrew Fedoniouk 
and choose 1). This is the minimal cost way to support D in more platforms. 
I don't mean to port SWING to D is a good idea. SWING is based on AWT and 
has some performance issue since the class hierarchy is too deep. I mean 
from ground and in pure D. Harmonia is interesting and should go further. 
But build one from ground may be a long time run. It is not easy for D 
community to bring such a toolkit for now.

If port some thing available, I'd like it be SWT. Java seems a sibling to D. 
Port java to D is far easy than C++ does. Eclipse/SWT is well designed and 
maintained. And seems it is accepted and supported by the industry. Port it 
to D is easier than invent new.


Just my thoughts. Sorry for my poor English.



"Matthias Spycher" <matthias coware.com> 
says:dsapvp$2n1n$1 digitaldaemon.com...
 I'm not an expert UI designer, but I've had the opportunity to work in 
 groups that use (or have used) all the mentioned toolkits. It's very 
 difficult to make a decision based on technical merit alone. QT is great 
 for high-performance static apps (not much dynamism/configurability at 
 runtime). The Java toolkits are quite good in the more dynamic environment 
 of a JRE (reflecting the smalltalk heritage). I would argue that AWT/Swing 
 and SWT will continue to benefit from the competition on the Java 
 platform. The SWT/JFace combo in eclipse demonstrate that you can build 
 very large sophisticated apps in Java. Performance is not as good as QT, 
 but it is sufficient for many apps. Take a look at IBM's Workplace Client 
 technology for example:

 http://www-128.ibm.com/developerworks/workplace/products/clienttechnology/

 I vote for DWT, not for technical reasons, but because it's a good 
 business decision. I very much agree with Shawn Liu's assessment of the 
 benefits of "getting close" to the eclipse ecosystem. SWT -> DWT may be 
 just a launch pad for something much bigger. Anyone who has used eclipse 
 with EMF and GEF knows where this train is heading. The model-driven 
 architecture (MDA), where most of an application's code is generated, is 
 becoming a reality. And if D can ride this wave, it has a much better 
 chance of survival.

 Matthias 
Feb 09 2006
parent Lucas Goss <lgoss007 gmail.com> writes:
I'm a GUI fan myself. But the one thing I don't understand about SWT/DWT 
is, why don't they use the factory pattern? Would there be no benefit? 
Or is it a performance thing since there are no interfaces 
(abstraction)? Or something else?
Feb 10 2006
prev sibling parent Bruno Medeiros <daiphoenixNO SPAMlycos.com> writes:
Here's an article posted on slashdot, with some more info between the 
GUI toolkits SWT, Swing and AWT:

SWT, Swing or AWT: Which is right for you?
http://www-128.ibm.com/developerworks/opensource/library/os-swingswt/?ca=dgr-lnxw01WhichGUI

-- 
Bruno Medeiros - CS/E student
"Certain aspects of D are a pathway to many abilities some consider to 
be... unnatural."
Mar 01 2006