Real Programmers Use Pascal

by Ray Lischner, author of Delphi in a Nutshell

In case you havent heard the news yet, Borland is porting their landmark Delphi product to . To many professional programmers, this is wonderful news. Earlier, you may have read Kylix is Coming!, in which I introduced the Kylix project and described it in general terms. Now that Borland has revealed more information about Kylix, I can give you more details.

Delphi is a rapid application development (RAD) environment, powered by a modern, object-oriented programming language and an extensible, component-based architecture. Currently, all this power is available only on Windows, where it is successfully being used in games, development tools, desktop applications, and used to drive web sites and connect multi-tier database systems. This article takes a closer look at Delphi for Linux and its companion product, C++ Builder for Linux.

Codename Kylix

Kylix is Borlands code name for a large project that involves porting Delphi and C++ Builder to Linux, working with tool and component builders to make sure third-party support is in place when the products ship, and getting the word out that rapid application development is coming to Linux.

Kylix isnt for everyone, though.

For one thing, the main programming language is Delphi Pascal. Just the name Pascal sends many programmers scurrying for the exits. But dont be too hasty. This is not your fathers Pascal. A far cry from traditional Pascal, Delphi has a number of modern conveniences, such as:

  • Object-orientation (single inheritance of classes, multiple inheritance of interfaces, single root class)
  • Integer overflow checking
  • Array bounds checking
  • Exception handling
  • ANSI and Unicode strings
  • Runtime type information
  • Built-in assembler
  • Unit-based modular programming
  • Static or dynamic linking of units
  • Strongly typed, except when you need latent type checking, which comes in the form of the Variant type
  • Multithreading support (TThread class, synchronization, thread-local storage)
  • Function overloading
  • Arithmetic operator overloading
  • Fast, optimizing, native compiler

In other words, Delphi has everything a programmer needs for modern software development (with one exception--generic types--but no language is perfect).

Rapid Application Development

The Kylix package contains more than just a souped up Pascal compiler, though. The integrated development environment (IDE) supports rapid application development, which means:

  • Syntax-directed editor
  • Integrated debugger
  • Visual design of forms ( and dialog boxes)
  • Visual design of menus
  • Extensible, component-based framework
    • Rich assortment of visual controls and widgets
    • Components to integrate with many popular SQL databases
    • Components for many popular Internet protocols
    • Commercial and freeware third-party components
  • Extensible design-time tools for creating:
    • Apache modules
    • Simple or complex database applications
  • Commercial and freeware third-party tools
  • Extensible IDE
    • No need to learn a separate extension or scripting language

Still not convinced? Thats okay. As I wrote earlier, Kylix is not for everyone.

Dont use Kylix if:

  • You like to get your hands dirty in the code. If you dont want to click and drag a component, but would rather write a few hundred or thousand lines of code yourself, you probably wont like Kylix.

  • You need to write kernel modules. Kylix does not support the GNU extensions that the Linux kernel depends on. (In particular, Kylix has a different syntax for writing inline assembly language.)

  • You are writing intensive numerical code. Kylix has an optimizing compiler, but it doesnt optimize floating-point arithmetic.

  • You have all the free time in the world to spend banging out code.
What Is RAD?

Now you know what Kylix isnt good for. What use is it? Rapid application development means just that--writing applications quickly and effectively.

Applications can be desktop tools, from games to word processors. They can be database clients, servers, or middle-tier layers. They can be network clients such as email readers, or network servers such as web servers.

The "rapid" part of the description means you can use Kylix to write applications faster than you could with traditional tools, such as gcc, emacs, vi, and gdb.

The first part of being rapid is the ability to design forms (windows and dialog boxes) visually. Click on a component, drop it on a form. Select a component and modify its properties. These features are commonplace, and you can find them in Glade, KDevelop, and other tools, so its no surprise to find this feature in Kylix.

Kylix is much more than a mere GUI-builder, though. It uses an extensible, component-based framework for widgets, database components, network components, and more. The framework is called CLX (component library for cross-platform, pronounced "kliks"). CLX is easily extensible. Already, third-party developers are writing components to supplement the standard components. Writing your own component can be as easy as deriving a new class from an existing component.

CLX comes in several parts:

  • BaseCLX contains the core parts of the component framework. Included are some simple collection classes (array-based lists), string-manipulation, I/O, date and time functions, file management, exception-handling, and more.

  • VisualCLX uses Qt , TrollTechs GUI toolkit, for graphics and visual controls. (Borland has negotiated a limited license with TrollTech, so if you purchase Kylix, you have a royalty-free license to use parts of Qt in freeware, shareware, and commercial products. You do not need to pay any additional fees to TrollTech for use of Borland-licensed Qt technology.)

  • DataCLX uses Borlands dbExpress to connect to a wide variety of SQL databases, including Interbase (which is now an Open Source product) and mySQL. You can use DataCLX in a single-tier architecture (database and application on the same machine), client/server, or multi-tier architecture.

  • NetCLX provides components for common Internet protocols, from direct socket access to TCP to FTP to HTTP. Write clients and servers, including Apache modules.

Because CLX is extensible, there will be a variety of components from third-parties. Several web sites (such as Delphi Super Page, and Torrys Delphi Pages ) host thousands of components that can be added to Delphi for Windows, and we can expect similar abundance of components after Kylix ships. Third-party tool and component vendors are already working with early releases of Kylix to get their components ready.

Components are convenient for many uses. For example, you can drop a POP3 Client component on a form, add a tree widget to display a hierarchy of folders, a list widget to display messages in a folder, and a text area to display a single message. To hook up these components, you add event handlers, which are just methods (member functions) declared in the forms class. Some event handlers are simple, s