[ Site Index] [ Linux Index] [ Feedback ]
So what's RAD, anyway?
RAD, Rapid Application Development, is one of those buzz-words that gets marketing people anxious in the operating systems world. Either you've got RAD tools or you haven't, and if you haven't, you're in big trouble. RAD tools are that vague category of programming environments that take all the leg-work out of programming.
The first generation of RAD tools provided a high-level programming language with extensions for accessing stored data and designing screen-based user interfaces; dBase II was an example of this category. Its target market was the sort of boring but necessary business application that is often specific to a single business -- inventory databases, point of sale systems, and so on. This market overlapped with conventional high level language compilers such as Pascal or C -- with the addition of an integrated development environment (IDE), database interface libraries, and screen libraries, you could use them as a RAD tool.
More recently, the rise of graphical user interfaces (GUIs) brought new requirements: the ability to rapidly write a graphical front-end to a back office application. The classic tools for this task were Hypercard (on MacOS) and Visual Basic (on Windows); in both cases, designing an application was more like using a graphics package to compose a user interface, then hanging fragments of object-oriented (or quasi-OO) code off of individual buttons, menu items, dialogue boxes, and other wwidgets. The same trend overtook the high level languages; Borland's Delphi product for Windows was an extension of Turbo Pascal with sophisticated screen-drawing tools and class libraries for accessing database servers.
Linux is descended from UNIX, traditionally a server operating system and workstation platform. This doesn't mean that Linux has no native RAD tools suited for development of business applications; but they come from a somewhat different lineage from the likes of Visual Basic and Delphi. UNIX applications have typically been written as network-aware client/server systems, with a client tool (such as a web browser or a newsreader) that communicates with a faceless server that provides services, talks to a database, and so on. As a result, rapid application development on Linux has traditionally taken place using very high level languages such as Perl, Tcl, and Python, or proprietary 4GLs such as Empress. Graphical interfaces have tended to lag, despite the sophistication of database interface systems such as Perl's DBI/DBD drivers (which support just about every SQL database available on UNIX and Windows) or web support systems such as Python's Zope (Z object publishing environment -- see Shopper #162). For example, to write a simple "Hello, world" program for X11 using the Motif widget set and native C compiler -- a program that simply throws up a button labelled 'hello, world!' and quits when you press it -- requires about a hundred lines of code!
Before Linux can become a major contender as a desktop operating system, it's necessary for developers to be able to easily produce applications with graphical front ends and the ability to talk to back-end servers easily. It must be easy to develop a GUI, easy to connect an application to relational databases or external network servers, possible to use shared libraries (Linux's equivalent of DLLs), and require only a minimum of work at the programming language level.
Luckily, RAD tools exist for Linux -- as well as Windows or MacOS -- that let us do all these things. And in this feature we're going to examine some of them.
Non-graphical RAD tools
The native RAD tools you get with any copy of Linux are based on VHLL's -- very high level languages. These programming languages were designed to make it easy to write business applications. The first of these was probably Perl, the Programmable Extraction and Report Language, which dates to 1987; it was followed by Tcl (Tool Command Language), Python (named after Monty Python) and Ruby.
These languages share certain features. They have very flexible type mechanisms, so that the programmer isn't lumbered with predeclaring every variable or manually allocating memory. They have lots of system interface commands or modules, so that you can easily write code that uses operating system features -- for example, it takes about two lines of Perl (and no external libraries) to resolve the IP address associated with a hostname. They have powerful library mechanisms, and lots of (free) external libraries that allow you to do things such as write internet servers or database clients easily. And they all have graphical libraries that let you write GUI programs.
However, it'd be a mistake to call Perl, Python, Tcl, or Ruby rapid application development tools in their own right. They're programming languages that lend themselves to RAD, but on their own they don't provide a full range of tools such as graphical interface builders. By the same token, an Object Pascal compiler isn't a RAD system; it takes the extra libraries and interface builder of Borland Kylix to do that.
So we're now going to look in turn at some of the graphical toolkits and interface builder tools that turn these languages into RAD environments.
The Tk toolkit, its languages and RAD tools
Tk is a graphics toolkit. Originally written for Tcl, Tk was initially based loosely on the Motif widget set. Tk has been ported to run on Windows and MacOS as well as UNIX, and has been linked into a variety of programming languages (such as Perl and Python) but is most commonly associated with Tcl, the combination being referred to as Tcl/Tk. Tk is a library; it provides a rich set of commands for drawing user interface widgets, and it can be embedded in other programs and has been ported to MacOS and Windows (as well as X11, its native environment).
Tcl and Tk are most commonly linked together in a simple interactive shell called Wish (the windowing shell) that lets you type Tcl/Tk commands to interactively prototype graphical applications. Wish can execute Tcl/Tk scripts and morphs into the graphical layout dictated by those scripts as they create widgets. There's a different interactive shell called wishX that incorporates the TclX extensions (for accessing operating system specific tasks), and a couple of other derivatives that add more specialised libraries.
If you are running a mainstream distribution of Linux, such as Slackware, SuSE, or Redhat, you probably already have Tcl/Tk. It's free software and ships as standard with all major distributions -- it is needed by a variety of common graphical applications.
If you want to compile your own copy of Tcl and Tk, including the interpreter, you can get it from http://sourceforge.net/projects/tcl/, or http://sourceforge.net/projects/tktoolkit/ for the definitive sources for the Tcl and Tk source code.
Tcl/Tk was created by Professor John Ousterhout of the University of California. He in turn set up Scriptics, a company that developed a kit called TclPro. Scriptics was taken over, and TclPro which has now gone open source: you can get it from http://sourceforge.net/projects/tclpro/. (Note that you will need to go to go to http://tcl.activestate.com/ftp/tclpro/download/FREE_KEYS to obtain a license key for releases prior to 1.5, which were originally released as closed source.) TclPro includes a Tcl compiler, source code checkers (that scan Tcl programs for static variable scoping errors and syntax errors), and a debugger.
Code coverage is supported by a number of other systems. Cygnus Source Navigator (see http://sources.redhat.com/sourcenav/) is a source code analysis tool and integrated development environment -- you can edit source code, display call trees and relationships between classes, fuctions, and members, and build projects. While Source Navigator isn't a pure Tcl tool (it also supports C, C++, Java, Fortran, and COBOL) it makes a seriously useful integrated development environment with its ability to explore a project and identify all locations where variables or functions are called. Get it from ftp://sources.redhat.com/pub/sourcenav/releases/.
Finally, ActiveState, vendors of Perl, Python, and other development tools ported from UNIX to Windows, sell support for Tcl; their ports of Tcl/Tk release 8.3 for Windows, MacOS, and Linux/UNIX, are available in source code and binary versions at http://tcl.activestate.com/software/tcltk/.
A lot of information about Tcl/Tk comes with the distribution, in the form of man pages. These are a bit hard to learn from; however, the main book about Tcl, "Tcl and the Tk Toolkit" by John K. Ousterhout (pub. Addison-Wesley, ISBN 0-201-63337-X) is still in print. This contains a tutorial and guide to Tcl, a tutorial and guide to Tk, and a section on linking Tcl and Tk to C applications.
Tk is a fairly easy library to use for building graphical applications. The core concept of Tk is that GUIs are built out of widgets -- objects like buttons, windows, scrollbars, and menus, which have associated attributes (size, colour, captions, and so on). Widgets are grouped together hierarchically within a toplevel window. Widgets can contain child widgets. Each widget determines its location on the screen using one of three "geometry managers", which specify the relative placement of widgets -- the packer (which you use to specify how widgets attach to one another), the placer (which lets you place items at arbitrary coordinates), and the canvas (which lets you mix packed widgets with arbitrary graphics, like a combination of the packer and the placer). It works best if you think of widgets as objects -- each widget has attributes which define its shape, how it packs or places itself within the window, any child widgets that it acts as container for, and its associated callback code (which is triggered when the user activates the widget).
The general structure of a Tcl/Tk program is to define the user interface as a hierarchy of widgets with subroutines executed by callbacks. Widgets show up on the screen when you ask a geometry manager to manage them, or when you invoke the pack command (to resize the widget's parent to hold them).
Now, if you thought this all sounds like a bunch of random tools rather than a RAD environment, you'd be right. A language, it's compiler and tools, and a graphics library, do not make a RAD toolkit. However, there are at least three GUI generators for Tcl/Tk that provide you with Visual Basic-like ease.
Visual Tcl (from vtcl.sourceforge.net) is a tool that provides a Visual Basic-like environment in which you can build a user interface out of Tk widgets and save out the resulting Tcl/Tk code. In use, it's fairly austere and basic. If you select a widget and attempt to edit its attributes, you need to confirm all your changes before any of them will show up; there's no dynamic binding between the widget layout you see on screen and the attributes you're updating. Vtcl can detect most of the Tk widget libraries you're likely to have installed -- for example, the Blt megawidgets -- and provides you with a palette to choose widgets from; you can also add your own widgets to the Compound->Insert menu. however, before you try using vtcl it helps to have some idea of how Tcl/Tk works and what widgets are available; the online help is sparse to non-existent when compared with, say, Kylix.
Vtcl isn't the only interface builder for Tk. Scriptics developed a more general tool for Sun, called SpecTcl. Sun stopped developing and supporting Tcl, but SpecTcl was released under an open source license and is now freely available. You can obtain SpecTcl from http://spectcl.sourceforge.net/ -- there are also versions that generate language output for Perl/Tk (SpecPerl), Python/Tk (SpecPython) and Ruby (specRuby) -- all linked from the SourceForge site. This brings up an interesting point, which is that the Tk widget set has spread like a weed; Tk is available for all those languages, and runs on all platforms, and uses much the same syntax for each (with minor variations to take account of each language's quirks).
As you'd expect for a product commissioned by Sun, SpecTcl has somewhat better documentation than Visual Tcl, including a full tutorial for new users. The user interface is bright, colourful, implemented in Tcl/Tk itself, and tries to look simple; it's essentially a shell around the Tk canvas, allowing you to lay out widgets in frames, specify how they link to each other, and so on. It doesn't give you full access to every feature in Tcl/Tk -- but what it gives you is a rapid and easy way of designing forms; in conjunction with Source Navigator's IDE-like features, SpecTcl gives you the essentials of a RAD tool (namely, efficient access to files in a project, an interface designer, debugger, and code coverage tools). Nor does this begin and end with Linux. SpecTcl runs on MacOS and Windows, and so do the programs it creates.
Just in case you thought SpecTcl and Visual Tcl were all the contenders, there's also tkBuilder, from http://sawpit.iwarp.com/. tkBuilder is, well, yet another Tcl/Tk interface builder tool. It runs under Tcl/Tk 8.x, has been tested on UNIX and Windows, and has a slightly different take on things; it's designed to let you manage the attributes of widgets using a tree-structured hierarchy diagram, and specifically helps you build and create megawidgets (things like complex dialogue boxes for use as a single widget in other programs). And then there's VisualGYPSY -- which has a number of advanced features. For example, VisualGYPSY supports automatically reconfiguring projects by sorting widgets on the basis of widget Z-order or any specified attribute, provides drag and drop editing (of the kind that Visual Tcl lacks), and integration with version control systems. And it, too, is free software (licensed under the Artistic License).
Given the plethora of GUI design tools for Tcl, it's almost an afterthought to talk about other code libraries. While Borland's Kylix comes with a pre-canned set of classes, you'll have to poke around for yourself to mix and match libraries for business applications. The best known libraries apart from Tk itself are in TclX. Extended Tcl is oriented towards systems programming tasks and large application development. TclX provides additional interfaces to the native operating system, as well as many new programming constructs, text manipulation tools, and debugging capabilities.
Itcl -- also known as incr tcl -- provides object orientation for Tcl. Incr Tcl adds to the Tcl language the concept of objects which act as building blocks for an application. Each object is a bag of data with a set of procedures or "methods" that are used to manipulate it. Objects are organized into "classes" with identical characteristics, and classes can inherit functionality from one another. Building on top of these core OOP constructs, Itcl provides incr Widgets -- an object oriented mega-widget set for Tk that delivers widgets such as paned windows (like multidoc windows), notebooks, and file selection dialogs. These are implemented using incr Tk -- a framework for building complex encapsulated widgets in Tk and incr Tcl.
Incr Tk isn't the only megawidget system for Tcl/Tk. BLT is an extension to Tcl/Tk that adds plotting widgets (X-Y graph, barchart, stripchart), a powerful geometry manager, a new canvas item, and several new commands to Tk -- such as a hierarchical outline box (so you can write your own clone of the Windows Explorer). Available from http://tcl.activestate.com/ftp/blt/.
For web-based work there's an entire multi-threaded web server written in Tcl, and a module that allows Tcl scripts to be executed by Apache (equivalent to mod_perl or mod_python). Java interoperation is available, too: JACL provides a java implementation of Tcl, while Tcl Blend allows Tcl programs to load and interact with a Java virtual machine. In combination, these tools allow you to write extensions to Tcl in Java, or to use Tcl scripts to control Java applications.
You can find a lot more Tcl libraries and applications at ActiveState, or via the comp.lang.tcl FAQ's, or the Tcl developer exchange.
KDE and Qt Designer
While Tk is all very fine and good as a cross-platform tool, it suffers from a couple of drawbacks. Firstly, it was originally designed for use with Tcl, an interpreted language: while it can be linked to (and used with) applications in compiled languages, it isn't brilliantly fast. Secondly, the interface design tools are fairly basic -- with the exception of SpecTcl, none of them provide extensive documentation and tutorials, for example, and support for languages other than Tcl, although available, is even less well documented.
The two main desktop environments available for Linux are Gnome and KDE. Gnome is built on top of the Gtk widget library, and KDE is built on top of Troll Tech's Qt widget library; both environments supply their own additional widget sets, and both of them have toolkits to make them platforms for rapid application development. While neither Gnome nor KDE boasts a tool in the same space as, say, Visual Basic, they do have some useful gadgets.
Qt is a high-level cross-platform toolkit (available on Windows, MacOS X, and embedded platforms as well as X11) that provides an object-oriented graphical application library for C++ programmers. In addition to the library, the most useful tool is the Qt Designer form design tool -- you can use this to automate most of the legwork of designing a user interface, and in conjunction with the KDevelop integrated development environment it gives you the facilities of a RAD environment for C++ programmers.
In use, Qt Designer gives you a clean-looking and professional environment for drawing dialog-based Qt applications. There are property editors for most widgets, an object hierarchy view so you can dink with groups of widgets, and the ability to hook up additional widgets to the Tools menu -- Qt Designer comes pre-loaded with some KDE widgets as well as the core Qt widgets. When you save your user interface design, Qt Designer creates a UI file -- in XML, using a DTD developed by Troll Tech -- that specifies the hierarchical structure of the interface. uic, the Qt user interface compiler, is then used to generate a .h header file and the implementation file of the dialog class. Having done this, you can use the KDevelop C++ IDE to add callbacks, compile, and debug the program to your heart's content.
One minor headache is that Qt Designer only generates C++ source code -- not much use if you're not a C++ programmer. However, TheKompany.com (a software group focussing on development tools) are working towards releasing a product called BlackAdder. BlackAdder combines an IDE, a user interface generator based on Qt Designer, a Python interpreter and debugger, and the PyKDE bindings to allow rapid application development of KDE applications in Python. Such applications will also run on Windows; at the time of writing this tool isn't yet out of beta.
Gnome and Glade
This business of using an XML file to specify the structure of a graphical application is not unique to Qt/KDE. It's at the heart of the Mozilla project, the open source web browser on which Netscape 6 is based; Mozilla's user interface is specified using an XML DTD and a specialised language called XUL. XUL has already been used to produce some applications based on Mozilla code, such as ActiveState's Komodo integrated development environment for Python (dropped as of 12/01). And then there's Glade.
Glade is the Gtk+ and Gnome user interface design tool. As Gtk+ is a free graphics library (unlike Qt, although Qt is available under free software licenses some of the time), it's no surprise that Glade is slightly less polished than Qt Designer -- but not by much. Gtk+ is a cross-platform widget library intended to be called from C, rather than C++ (although C++ bindings are available). Gtk+ takes a slightly different approach to other widget sets: widgets are placed inside containers such as horizontal or vertical boxes and tables. However, in use, the Glade tool feels rather similar to Qt Designer (except that it provides a number of free-floating palettes rather than a single workspace with toolbars).
Glade produces user interface code in XML, as does Qt Designer. Glade can process XML interface files into C source code directly. Glade can also emit Eiffel, Ada95, and C++ source code -- and then things get weird. Because there's a special extra library, libglade -- details at developer.gnome.org -- that acts as an interpreter for Glade UI files. If you write a program linked to libglade, you can tell it to load a previously-designed UI file, and it will generate the corresponding user interface on the fly.
Glade can provide Python and Perl programs with the ability to create Gnome or Gtk+ interfaces; you can find Python tools, and a Perl kit. In both cases, you use a UI compiler to generate a Perl (or Python) program that calls the Gtk+ and Gnome libraries to create the appropriate GUI, and a subclass that you can edit to add your own callback code.
After splashing around in the sticky swamp of half-built GUI designers for the native UNIX/Linux languages, it is something of a relief to run across Borland's Kylix. This is not to denigrate the efforts of the Glade or Visual Tcl developers -- but Kylix has one feature that none of the other tools (including Qt Designer) can offer: completeness. Because Kylix is a full port of Borland Delphi to Linux.
Delphi is the long-term descendant of Borland TurboPascal; an object- oriented superset of Pascal coupled with a very slick integrated development environment, a complete, full-featured GUI designer with editor widgets for absolutely everything, and a class library full of goodies. Kylix provides mostly-complete portability from Delphi on Windows to Linux, and provides a degree of interoperation with KDE's theme system so that Kylix applications will look right at home under KDE. For a look at Kylix from a Delphi programmer's point of view see
Kylix is such a large product that it could easily fill this entire review slot. The online help facilities alone outweigh anything else seen in the Linux RAD field; the set of user interface widgets is sufficient to have made this the #1 non-Microsoft programming environment on Windows, and the Server Edition provides additional classes for building TCP/IP client applications (with client classes for NNTP, SMTP, FTP, HTTP and other common protocols). The web server interface is of rather more questionable utility -- unless you specifically need to hack Pascal into your web scripting system, it's probably better to stick to Perl or Python. But one point is worth noting: while Kylix mostly emphasizes re-use of Object Pascal classes, it can link to (and call) Linux shared libraries. This makes Kylix a rather intriguing proposition for building graphical interfaces to faceless server programs.
Borland is addressing two markets with Kylix; Windows/Delphi programmers wanting to port to Linux, and a new niche market of open source developers who want full-featured RAD tools. Kylix is a commercial product, but Borland's licensing permits distribution of GPL'd free software written using Kylix, and distribution of binaries compiled and linked using Kylix. While the core system is sold for US $199 (and the Server Developer edition, which provides classes for compiling applications as Apache modules and for talking to relational databases such as Oracle, Interbase and MySQL, for $1999), core components of the CLX class library are available under GPL here, and Borland have announced their intention of releasing a free edition of Kylix limited specifically for compiling/developing GPL'd applications. It remains to be seen whether Kylix will gain a large following among experienced Linux developers (as opposed to new immigrants from the world of Windows), but it sets a new and very welcome standard for RAD tools on this platform.
[ Site Index] [ Linux Index] [ Feedback ]