Google Search

Saturday, April 25, 2009

A quick review of different UI frameworks

In this post I'll review several frameworks used for creating graphical user interfaces. I've decided to create such a review after noticing many programmers take a specific GUI framework for granted, as it is their automatic-choice-by-tool (i.e., they use what they're IDE let them, barely understanding the layers required to develop such a framework, and that there are alternatives they might have chosen if they had knew about).

I will review the following frameworks:

  • Windows.Forms
  • WPF (+Silverlight)
  • GTK
  • QT
  • wxWidgets
  • AWT
  • Swing
  • SWT
  • X/XT/Motif

Windows.Forms

Naturally the automatic choice for anyone who builds a GUI in .Net. The first version was there from the very first .Net release, and supported by all versions of Visual Studio, the main IDE for .Net development.

When you ask most .Net developers what are they are using to build forms for their applications, they will most likely say "The default thing that comes with Visual Studio" or "... with .Net". Most won't even know other UI frameworks exist.

And for some technicalities: Windows.Forms in its original implementation wraps the underlying Windows native controls. In its second version, some controls where added that doesn't wrap any base controls, but rather implemented the entire logic and graphics internally in C#.

As most .Net frameworks, their immediate audience is the Windows users (or in this case - developers). However, the Mono project had implemented all the Windows.Forms controls entirely in C#, not wrapping anything at all, while maintaining complete API compatibility (including message loop interference). Due to the nature of .Net binaries, this allows migration of compiled applications from .Net to Mono, hence from Windows to Linux.

WPF (+Silverlight)

The newest technology reviewed in this list. Has not yet become a natural choice of any developer (mainly due to the lack of tools and IDE integration), but it is getting there. Unlike any other framework listed here, this framework does not base on the underlying windowing system at all. The only use it has for the windowing system is to open and register a top-level window. From now on it is all DirectX (at least in the WPF implementation).

Using XAML as the main form of defining UI, and tools that resemble artistic programs more than IDEs, WPF really allows developers and designers to work together, letting each one focus on what he can do best, providing better separation between the two worlds. Also, it allows to create applications that are much more appealing visually than most common applications.

WPF stands for “Windows Presentation Foundation” and was introduced with .Net framework 3.0.

Silverlight is a subset of WPF, targeting the web. Allowing roughly the same features as WPF, in the same development model, using the same tools, it bridges the gap for developers and designers to move from desktop to web environment and vice-versa, allowing knowledge and components to be persisted and reused.

Moonlight is an open-source implementation of Silverlight, part of the Mono project, aims to bring Silverlight to the Linux world.

GTK

The automatic choice for anyone who develops applications for the Gnome Linux desktop. Written in C, and have many language bindings, including C#.

GTK was originally developed to support the development of The GIMP (the GNU Image Manipulation Program), thus was named “GIMP Tool Kit” – or GTK for short. Later on it became the main toolkit for the entire Gnome Linux desktop project.

This is an open-source (LGPL) library, developed and maintained by the community.
GTK is a source-code-compatible, cross-platform toolkit, that has binary distributions for Linux, Windows, and Mac OS, and has some support for mobile devices as well (it runs on some Nokia smart phones, and used to build the OLPC project and the OpenMoko project user interfaces).

It supports several levels of themes (Skins and Theme Engines), and has default themes for each operating system, especially for the Windows and Mac OS, that have very specific themes. This allows GTK applications to merge in the look and feel of those operating systems.

QT

Originally developed by TrollTech, now owned by Nokia and supported by the community. Written in C++ and utilizing a Meta-Object-Compiler - a special precompiler that adds several features to the C++ language, mainly used for easier data binding. Some language bindings are available, including a community binding for C#, named Qyoto.

QT is a cross platform framework targeting both Desktop and Mobile applications.
In its open-source license (GPL, LGPL) it is used to develop the KDE Linux desktop environment, while in its commercial license it is used by commercial software and hardware vendors to build the GUI of their products.

QT has a very good support for themes, allowing it to merge in the look and feel of just about any environment, including Windows, Mac OS, and even the Gnome Linux desktop (by reading the Gnome theme configuration file).

wxWidgets

wxWidgets is a cross-platform framework designed to use each system’s native controls to the max, while preserving common API and rich set of controls. Written in C++ and has several language bindings including C#.

There are no common tools that support visual design for it, but there are several visual designers for it out there, such as “DialogBlocks”.

AWT

The Java most basic set of UI controls. AWT stands for “Abstract Windowing Toolkit”, and works in the same manner as .Net's Windows.Forms, but implemented differently on each JVM (i.e., wraps each system's native controls - The native Windows controls on Windows, usually GTK on Linux, and Cocoa on the Mac.)

Swing

Swing is Java’s themable UI framework, written completely in Java, using AWT’s most basic controls only, and built from scratch on top of than.

While this allows much nicer look and feels, Swing came too early and suffered from bad performance caused by the need to draw heavy graphics using a virtual machine on computers not strong enough at the time. This caused many developers to look for alternatives, and SWT was the most common one.

SWT

This one can be compared to the second version of Windows.Forms, or to wxWidgets, if you'd like. Based on each JVM implementation of AWT, makes a so called "Mix and Match" to create a better set of controls, that can run on each operating system and gains its native look and feel, while bringing large set of controls and maintaining performance by using the operating systems native controls.

X/XT/Motif

The 'X' Windowing System is the service that bring graphics and windowing operations to the Unix world. Like most windowing systems, this system is also based on a message loop and message dispatching, where each control is usually a window.

The X-Toolkit (XT) is a library helping to develop controls. It separates the control logic and design from the need to handle all the events passed to it from 'X', thus allowing vendors to focus on developing the controls themselves. Over time this approach has failed to persist, as no new control sets where created after Motif, and newer GUI frameworks (toolkits) had chosen to handle all events themselves, which also helped building cross-platform GUI frameworks.

Motif is the most commonly used set of controls that was build for the X-Toolkit framework, allowing large variety of controls for different aspects of GUI development.


kick it on DotNetKicks.com

4 comments:

  1. Hi, at http://www.xamltemplates.net you can see a lot of hemes for all the wpf and silverlight controls.

    ReplyDelete
  2. Sadly you have omitted the AppKit of Cocoa (or GNUstep):

    http://cocoawithlove.com/2008/08/application-design-in-appkit.html

    http://devworld.apple.com/documentation/Cocoa/Reference/ApplicationKit/ObjC_classic/Intro/IntroAppKit.html

    http://wiki.gnustep.org/index.php/AppKit

    ReplyDelete
  3. Yes, I did omit it, partly by mistake, but mostly because I have no experience with it, at all, so I can't really share my thoughts on it except that "It's called Cocoa and it runs on Mac".
    Also, I tried to stay on the Cross-Platform side as much as I could, and the only exceptions are WPF (not implemented in Mono, not planned to, but at least Silverlight is), and X/Motif, which I wouldn't write about, but after I had to work with it for about 5 years, I felt like I had to write something :-)

    ReplyDelete
  4. Great bit of information. Thanks.

    Regards,
    image manipulation

    ReplyDelete