扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
Real Programmers Use Pascal
by Ray Lischner, author of Delphi in a Nutshell
In case you haven't heard the news yet, Borland is porting their landmark Delphi product to Linux. 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.
Kylix is Borland's 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 isn't 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 don't be too hasty. This is not your father's Pascal. A far cry from traditional Pascal, Delphi has a number of modern conveniences, such as:
In other words, Delphi has everything a programmer needs for modern software development (with one exception--generic types--but no language is perfect).
The Kylix package contains more than just a souped up Pascal compiler, though. The integrated development environment (IDE) supports rapid application development, which means:
Still not convinced? That's okay. As I wrote earlier, Kylix is not for everyone.
Don't use Kylix if:
Now you know what Kylix isn't 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 it's 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:
Because CLX is extensible, there will be a variety of components from third-parties. Several web sites (such as Delphi Super Page, and Torry's 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 form's class. Some event handlers are simple, such as the tree widget's OnChange handler, which looks up the selected folder, retrieves all the messages to display in the list widget. Because you have the full, object-oriented power of Delphi or C++ at your disposal, you can make the event handlers as simple or complicated as you want.
In less than a day, you can have a basic, but fully functional email client.
RAD has a bad rap in some circles because of tools that allow you to rapidly build extremely limited applications. The authors advertise that you can build applications with point-and-click ease without writing much code. We all know that real programming problems require real code.
What makes Kylix RAD especially powerful is that the CLX component framework simplifies the tedious aspects of application development, without hiding the power of the language and operating system. If you need to make system calls directly, you can.
Instead of wasting your time writing code to manage windows and widgets, you supply the guts of the application: business logic, computation, organization, or what have you. Kylix is designed for large and small applications. When writing code, the source editor helps you in many ways: Even if the source editor is missing a feature that you want or need, you can extend the editor and other parts of the IDE.
Extensible IDE
Sometimes, though, you need more power than a component can provide. Kylix has an extensible IDE so you can add new design tools. For example, a menu bar is a component, as is a popup menu. These components, in turn, contain menu item components. Editing components is a poor way to design menus, so Kylix has an interactive menu editor that makes is easy to edit menus visually. Kylix also comes with wizards (as these tools are called) for designing database applications, web server modules, and more. Because the IDE is extensible, third-party developers are working on additional wizards, and you can write your own.
Some tools require you to learn a special extension language (such as Emacs Lisp). In Kylix, though, you can continue to use your everyday development language. Extend the Delphi IDE using Delphi or C++ Builder using C++. You can even extend Delphi with a wizard written in C++ Builder or vice versa, so third-party developers can use their language of choice and distribute their products to all Kylix users.
You can extend the IDE in several ways. You can:
On the other hand, if you prefer command line tools; if you don't want the convenience of a WYSIWYG form editor; if you like the challenge of locating and debugging buffer overruns; then by all means, continue to use your current tools. You wouldn't be happy with Delphi.
Real Programmers use Pascal, but sometimes you need or prefer C++, so Kylix will include C++ Builder for Linux. C++ Builder uses the same IDE and component framework as Delphi, but with the C++ language. To use the Delphi component framework, you must use Borland-specific extensions to the C++ language. Note that C++ Builder does not support GNU extensions, so don't try to recompile the Linux kernel with C++ Builder.
If you prefer standards, C++ Builder can compile ISO standard C++ and C, too. You can compile any application that adheres to the ANSI/ISO standards, and you will probably find that C++ Builder for Linux compiles faster than gcc or g++. You also get the advantage of an extensible syntax-directed editor and an integrated debugger, even if you don't take advantage of CLX and the interactive form builder, menu builder, and other RAD tools.
Kylix will produce native x86 code, producing standard ELF binaries (programs and shared objects). No byte-code, no virtual machine, no runtime library, no Windows emulator needed.
The first release of Kylix will not support other hardware platforms. You will be able to link gcc-compiled object files into a Delphi project, but g++ classes are not binary compatible with Delphi or C++ Builder. Future releases will probably support additional hardware platforms, as the market dictates. Perhaps we will see Delphi and C++ Builder on other operating systems, too.
CLX is portable between Linux and Windows, and is designed to support other platforms in the future. Thus, Delphi 6 for Windows will also support CLX (in addition to its native Windows component library, the VCL). Your source code can be ported without change between Linux and Windows, provided you avoid system-specific functions (or you can use conditional compilation).
Borland is firmly committed to remaining neutral when it comes to desktops and distributions. Naturally, they want you to use Kylix regardless of whether you prefer Red Hat, Mandrake, Caldera, Slackware, SuSE, or what have you, or whether you use KDE , GNOME, or just plain old fvwm. The development tool should not dictate end-user decisions. That said, the first release will favor KDE slightly because Kylix and KDE both use Qt . Kylix applications will run on GNOME, but will not take full advantage of GNOME-specific features. You can expect future releases to provide better support for GNOME.
The core Delphi Pascal language will not change significantly in Kylix, nor will Borland's C++ extensions. Most of the reference material in Delphi in a Nutshell will apply equally to Windows and Linux, except for a few Windows-specific features. I will post any language changes posted to oreilly.com.
Or not. Linux currently faces three significant hurdles against wide-spread acceptance as a desktop operating system: ease of installation, ease of use, and availability of applications. Kylix can't help with the first, but it can with the next two.
Why do I use Windows to read my email? Why am I writing this column under Windows? The simple reality is that many applications are available only under Windows. I've tried many email and news clients on Linux, but I prefer my Windows-based application (Agent, if you must know). I've tried numerous HTML editors, but I prefer Visual Page for Windows. One of the difficulties facing Linux application developers is that Linux lacks tools for producing high quality desktop applications.
If you want to throw together a quick and dirty interface, you can use Tcl/tk. If you need more programming guts behind the interface, switch to Python and Tk. If you need the performance of a natively compiled application, though, you must resort to C or C++. Sure, you have some toolkits, such as Qt and Jx. These toolkits even have basic IDEs. Kylix has all that and more.
Borland expects to deliver Kylix sometime in 2000. When Kylix ships, its feature list will read like the to-do list for other Linux RAD tools. For professional developers and many others, Kylix will be a valuable addition to the suite of development tools on Linux. Not everyone will want to use Kylix, and not everyone should. But if you value your time, if you want to use cutting-edge tools, if you want to make your mark in the Linux application space, you should take a close look at Kylix. Codename Kylix
Variant
type
Rapid Application Development
What Is RAD?
C++, Too!
Linux and Cross-platform
How Kylix Will Save the World
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者