Long sessions.
Awkward environments.
Convoluted rules.
Missile guidance systems.
This is the computer language that many people know as
Ada. Today's Ada looks more like Inprise's Delphi than its caveman ancestor,
and soon will produce Java applets that you can drop into your web sites.
However, does it stack up against other languages available for Linux?
C++ is the de facto standard for Linux programming. After all, the kernel itself is written in C. However, C++ is not suitable for all kinds of projects because different computer languages have different strengths and weaknesses. Ada was designed for team development and embedded systems, leading to advantages over C in development time and debugging. An in-depth 1995 study by Stephen F. Zeigler (http://sw-eng.falls-church.va.us/AdaIC/docs/reports/cada/cada_art.html) showed that development in Ada costs about half that of C++. It also suggests that Ada produces "almost 90% fewer bugs for the final customer".
The test bed compiler for Ada 95 was gnat.
Gnat was developed closely with gcc, the native C compiler for Linux. Unlike some compilers that translate a program into C and then feed the C program into gcc, gcc has built-in support for the Ada language. Like g++, gnat works with with gcc, allowing it to produce fast, quality executables without any intermediate steps.
This integration gives a lot of flexibility to programmers who want or need to support multiple languages. Gnat has an extensive set of features for trading variables and function calls between Ada and C/C++. It can import C/C++ items into Ada, export Ada items to C/C++. You can also link Ada functions indirectly into Java, using Java's ability to import C++ functions.
Gnat comes with over 140 standard libraries. These include numeric and string libraries, file operations, hash tables and sorts. If you would rather work directly with Linux C libraries, a variety of "binding" libraries exist, available for download from the Public Ada Library or The Home of the Brave Ada Programmers. These include bindings for POSIX (that is, the kernel), X Windows, Motif, TCL and WWW CGI applications.
Although gnat is distributed under the GPL license, gnat
and its libraries may be used in commercial applications.
Java | Ada | C | |
JDK 1.0.1 | gnat 3.09 | gcc 2.7.2.1 | |
Test | |||
Constant assignment | 20.68 | 0.36 | 0.23 |
Long Int assignment | 20.88 | 0.35 | 0.22 |
Long Int multiply | 29.50 | 0.38 | 0.23 |
Array access | 24.52 | 0.64 | 0.23 |
Function Calls | 15.63 | 1.07 | 0.22 |
Strings Concatenation | 19.29 | 0.35 | 2.75 |
Gnat performed well against gcc. Inspite of gnat's extensive run-time error checks, the test programs ran on average only a third slower than gcc. With these checks disabled, you should get performance comparable with C. As an interpreted language, Java ran several times slower than either Ada or C.
The following table presents a summary of some common features, compared with others languages (including Delphi):
C++ | Java | Ada | Delphi | ||
Feature | |||||
Objects & Classes | yes | yes | yes | yes | |
16-bit Characters | NO | yes | yes | yes | |
Short Circuiting | NO | yes | yes | yes | |
Overloading | yes | some* | yes | yes | *no infix operators |
Inlining | yes | NO | yes | yes | |
Built-in Multithreading | NO | yes | yes* | yes | *has 2 kinds |
Multiple Inheritance | yes | interfaces | NO | NO | |
Polymorphism | yes | yes | yes | yes | |
Private fields | yes | yes | yes | yes | |
Built-in Distributed Processing | NO | NO+ | yes* | NO | *requires free add-on
+not built-in, uses a class |
Garbage Collection | NO | yes | yes* | yes | *not implemented by gnat |
As you can see, Ada holds its own against Java.
If you don't have gcc 2.7.2.1, you can specify a separate directory where gnat will install itself and its personal copy of gcc 2.7.2.1. To make gnat available, you have to perform two additional steps:
Once you have the binaries installed, the more adventuresome can recompile gnat for their version gcc:
Similar to Samba, ACT can provide comprehensive commercial support, but it costs several thousand dollars. The support includes priority bug fixes and the latest version of gnat (compiled against whatever version of gcc you are using). The commercial support is not strictly required for serious projects for the same reason that Samba isn't. Technical assistance is available on the Internet, and since the compiler adheres to the international standard and has been well-tested, the public release is as well-built and reliable as gcc itself. The commercial support is aimed at substantial projects that need high level support, such as projects critical to the success of a business or department.
Gnat comes with extensive documentation in HTML format
that you can browse with lynx or Netscape. This includes complete coverage
of all of gnat's unique features and options. Unfortunately, no tutorial
for Ada is included.
ACT also provides a free gnat add-on called "Glade", which enables Ada 95's built-in distributed processing support. Programs using Glade can work with each other transparently over a network.
When testing gnat, I found a minor problem related to the normalize_scalers pragma. This is a compiler directive that helps to detect variables used before they are initialized. The directive worked fine except in a package containing object definitions. All other language features I tested appeared to work properly under Linux, including multitasking.
Gnat's executables can be several times the size of a gcc executable. Gnat provides compiler directives to reduce a program's size, but if a small footprint is an important issue, you may want to avoid gnat.
Gnat also lacks an IDE, but this is a common problem for Linux languages.
My biggest complaint isn't with the language: it's ACT's uneven customer support. Although I've always received prompt replies from ACT, they are not always courteous or helpful, and I've often been more frustrated than enlightened.
Once I went to my local photocopy shop to make copies of the gnat manual, and they refused because the manuals contain a copyright notice. I emailed ACT and they were quick to respond that the copyright notice would be changed in the next edition. It's been over a year since they updated their FTP site, and I'm still waiting to see this simple change.
On another occasion, my software company was investigating gnat's suitability as a development platform for Linux. As far as we knew, ACT could have been run out of Robert Dewar's basement. We wanted to know that there would be future releases of gnat before we committed ourselves to developing a software base and suffer the stigma of programming in Ada. At first we were told we shouldn't consider developing in gnat unless we had their commercial suppport. Then we were told that they wouldn't provide commerical support for a fledgling company like ourselves. If ACT would have given us a straight answer on the commercial support, told us that we would still be supported on a non-priority basis, and wished us luck on our future endevours, we would have been more than happy. Instead, we felt that they had been dishonest with us and then told that we were dirt when we had gone out on a limb to consider gnat in the first place.
No company should be rude or disrespectful to its clients.
They deserve straight-forward answers, timely fixes, and a "please" and
"thank you" now and then to show their interest is appreciated.
Robert Dewar, the head of ACT, assured me that "ACT is committed to providing high quality Ada 95 products for Linux. We have a number of serious Ada users using Linux today, and we intend to continue to serve the Linux market for such users."
When speaking of Linux's exponential growth over the last two years, Mr. Dewar was quick to point out that the gnat Linux market is currently small. ACT is not interested in promoting the Ada 95 standard. They would rather spend their time improving their products and selling them to the existing Ada markets. That the Linux community has largely overlooked gnat is not surprising.
The difference between a successful project and a failure can
often hinge upon choosing the right development tool for the job, and gnat
has a lot to offer. Gnat brings a versatile development environment to Linux,
an efficient compiler and a rich set of development tools, and that is
something the Linux community cannot ignore. Whether or not gnat has a
bright future in Linux is anybody's guess, but it would be a shame if a
high quality piece of free software should be overlooked. This is a lesson
that all Linux enthusiasts have learned very well.
Ada Core Technologies (ACT): http://www.gnat.com
Ada Information Clearinghouse (AIC): http://sw-eng.falls-church.va.us/
Gnat FTP Site: ftp://cs.nyu.edu/pub/gnat
Home of the Brave Ada Programmers (HBAP): http://www.adahome.com
Public Ada Archive (PAL): http://www.wustl.edu
Samba: http://samba.anu.edu.au/samba/
Books
Professional Java Fundamentals. Cohen, Shy et al.
Wrox Press, 1996.
Programming in Ada 95. Barnes, John. Addison Wesley,
1996.
C++ for Professional Programmers. Blaha, Stephen.
Int'l Thomson Computer Press, 1995.