The programming language of hell. Ada (programming language) programming hell

The Ada programming language was born in the mid-1970s, when the US Department of Defense and the British Department of Defense decided to replace hundreds of specialized programming languages ​​for embedded computing systems that were increasingly used in military projects. The Ada language was designed to be the only language capable of running on all these embedded systems, while providing reliability and performance at a level no worse than specialized ones.

After the 1995 update, the language was adapted for general purpose systems, adding object-oriented programming, without losing sight of the core values ​​of reliability, ease of support, and efficiency. Today, software written in Ada forms the basis of not only military equipment, but also commercial projects in the field of avionics and air traffic control systems. The Ada code controls rockets like Ariane 4 and 5, many satellites, and countless other systems in which small glitches can have serious consequences.

Ada might be fine for use in your next embedded project as well.

Military quality planning

To select a new programming language, the Department of Defense assembled a "High Order Language Working Group (HOLWG)" of military and academic experts to draw up a list of requests and select candidate languages. As a result, the so-called. "Stillman's queries":

The main points of the requests were:

  • General purpose flexible workflow that adapts to the needs of embedded computing applications.
  • Reliability. The language should facilitate the design and development of reliable programs.
  • Ease of support. The code should be readable and the software solutions clear.
  • Ease of producing efficient code. It should be possible to easily identify ineffective designs.
  • No unnecessary complexity. The semantic structure should be consistent and the number of concepts should be minimized.
  • Machine independence. The language should not be tied to any details of the OS or hardware.
  • Complete definition. All parts of the language must be fully and unambiguously defined.
The report ended with the opinion that the first line of defense against software problems is to prevent programmers from making mistakes. By eliminating the possibility of making a subtle mistake, for example, through implicit type conversions or other dangerous constructs, we automatically make the code safer and easier to maintain.

The group concluded that although none of the languages ​​that existed at that time were suitable for the needs of the Ministry of Defense, it was quite possible to create a new language that would fit all of these issues. Four designers got it done. The intermediate selection process selected the two most appropriate working methods, and in the end only one language won the competition and was named "Ada".

Built-in default protection

Ada's type system isn't just strict - it's sometimes called super-strict because it doesn't allow any implicit casting. Take, for example, this piece of C code:

Typedef uint32_t myInt; myInt foo = 42; uint32_t bar = foo;
This is valid code; it will compile, run, and give an obvious result indicating the answer to the main question of life, the universe, and all that. In Hell, this will not work:

Type MyInt is Integer; foo: MyInt; bar: Integer; foo: = 42; bar: = foo;
The compiler will throw an error because Integer and MyInt are not the same thing. The main advantage of this approach is that if the programmer later changes the type definition, thousands of implicit type conversions throughout the codebase will not blow up the program. Instead, cast types explicitly — this promotes good code by preventing confusion between types that are “similar enough”.

Any programmer stuck in the swamp of a mixture of standard C, Linux and Win32 type definitions can appreciate the lack of having to rummage through countless pages of documentation and poorly formatted code to figure out which typedef or macro contains the real definition of something that only what prevented compilation or got out during debugging.

Ada adds additional layers of protection in compile and run checks. In Ada, the programmer must explicitly specify the closing statements for the blocks and the boundaries in which the value of the variable should fit. Ada does not define standard types like int or float, but requires the programmer to create types with a specific range from the beginning. This is true for strings as well - except for unlimited strings, all strings have a fixed length.

At the stage of work, you can check for errors such as incorrect memory access, buffer overflow, overruns, ± 1 errors, and array access. They can then be safely handled instead of dropping the entire application.

Ada implements the reference type model instead of low-level pointers. Each reference type is handled by a pool of memory, either default or programmer-defined for more exotic NUMA memory implementations. The programmer never needs to access memory directly, he must use a memory pool handler.

Finally, the compiler or program decides at runtime how to pass data to or from a function. And although the direction of passing each parameter must be specified ('in', 'out', or 'in out'), the final decision on whether data is transferred via registers, heap or by reference is made by the compiler or the program at runtime, but not a programmer. This prevents stack overflow problems.

Ravenscar profile and SPARK dialect are subsets of Ada, with the latter concentrating on contracts. Over time, the features of these subsets have been moved to the host language specification.

Ada programming today

ANSI established the Ada 83 specification in 1983. The Intel 80286 had just been released, and the Motorola 68000 processor was only four years old. It was the dawn of home computers and the awkward transition from the 1970s to the 80s, when the popularity of microcontrollers began to rise. Imagine the Intel 8051 microcontroller and its stunning 4KB EPROM and 128B RAM.

Microcontrollers popular today are many times more powerful than those that were in 1983. You can take any ARM, AVR, RISC-V, etc. (or the Lego Mindstorms NXT kit) and start developing for it with the same C-based tools. No wonder the popular GNAT Ada compiler is based on GCC. Also in development under the DragonEgg project are LLVM-based tools.

There are two versions of the GCC-based Ada tools. The AdaCore variant is commercially supported, but it has its own peculiarities. The Free Software Foundation's version is naturally free, and is comparable in functionality to AdaCore.

For an easy start, use either the GNAT Programming Studio IDE (GPS) bundled with AdaCore (copy on Github), or write the code in a text editor and compile it manually, or using Makefiles. The toolkit is a little more complex than that of C or C ++, but development is facilitated by the gnatmake utility, which includes all the tools, and works roughly like GCC.

An example of a small, but non-trivial project in Ada, written by your humble servant in the form of a command line argument parser. There you will find a Makefile located in the ada / project folder, which defines the folders where you can find the package specification files (.ads) and the packages themselves (.adb).

These files roughly correspond to the files with headers and code from C and C ++, but they also have important differences. Unlike C, Ada does not have a preprocessor and does not combine code and headers to create compiled files. Instead, there is a link to the package name specified in the specification. The name of the .ads file does not have to match the name of the package either. This gives you a lot of flexibility and prevents common C problems with circular dependencies or having to link headers in a specific order.

Where to go next

After downloading the GNAT toolkit, running GPS or Vim / Emacs, and looking at the blinking cursor on a blank page for a while, you might be wondering where to start. Fortunately, we recently covered an Ada based project using the PicoRV32 RISC-V kernel. It uses the popular ICE40LP8K CPLD, which is supported by open source FPGA toolkits such as Yosys.

In terms of documentation, there are introductory articles for beginners aimed at Java and C ++ developers, the AdaCore reference, the WikiBooks reference, and of course the Programming in Ada 2012 documentation. These are arguably the most comprehensive references, with the exception of the 945-page Ada 2012 Language Reference Manual (LRM) documentation.

The Ada language, although quite rare for programmers, is a completely open language with reliable development tools with commercial support, and is used to create software for everything from intercontinental ballistic missiles and F-15s to medical device firmware. While this is a rather complex language, if you go beyond the basic limits, it should definitely be on the list of languages ​​that you have ever used in your projects - even if it was to make your resume look cooler.

High-level, focused on application in real-time systems and designed to automate the tasks of controlling processes and / or devices, for example, in on-board (ship, aviation) computers.

The Ada language was developed at the initiative of the US Department of Defense in the 1980s, and is named after the mathematician Ada Augusta Lovelace (1815-1851). When designing the language, first of all, attention was focused on reliability and efficiency - the language was created specifically for the development of large real-time software systems for embedded systems, to which high reliability requirements are imposed; first of all, these are military systems.
The Ada language is based on the ideas of structured programming and provides the development of complex multi-module programs, a high degree of machine independence and portability. Ada contains the features of Pascal-like languages ​​such as type definitions, common control structures and subroutines, and the advances in programming language theory since 1970. The language maintains logical modularity, for which data, types, and subroutines can all be packages. Physical modularity is achieved by separate compilation. The Ada language supports real-time programming through parallelism and exception handling mechanisms. System programming is supported by access to system-dependent parameters and precision control of data presentation.

By 1974, many different programming languages ​​were used in the structures of the US Department of Defense. This increased the time and money spent on the development of new systems and on the technical retraining of personnel. The heads of the ministry came to the conclusion that it is necessary to use a single programming language. In 1975, a list of requirements for such a language was agreed. None of the programming languages ​​that existed at that time (such as Pascal, ALGOL-68 or PL / 1) met the requirements. Therefore, in 1977, it was decided to create a new language, and a competition was announced for its development. Of all the proposals, four were selected (each of which was an extension of Pascal), for subsequent revision and refinement. Later, for further clarification, two of them were selected, and in the final they chose a project presented by Cii-Honeywell Bull. This language was given the name Ada (originally the language was called DOD-1).

In 1983, the ANSI / MIL-STD-1815A language standard was adopted, and in 1987 - the international ISO 8652 standard. In 1987, the first effective Ada translators appeared. The ISO standard was revised in early 1995 (ANSI / ISO / IEC 8652). The new standard corrected many of the omissions and shortcomings of the original language, and supplemented it with many new useful properties, such as procedural types, based pointer types (that is, pointers to non-dynamic objects), hierarchical libraries, additional concurrency controls, and many standard libraries. In addition, in Ada-95 there was support for object-oriented programming.
The next standard was given the informal name Ada-2005, although it had not yet been adopted in 2005. The Ada community decided to move away from the tradition of informally naming the standard by the year of publication, since in 2005 all its main parameters were agreed. The language adds multiple inheritance, a prefixed form of access to object methods, more flexible reference types, improved task management, and a large number of new standard libraries. In addition, Ada-2005 complies with the ISO / IEC 10646 (2003) standard, which allows using the letters of the Russian and Greek alphabets in the names of identifiers (names of variables, functions).
Ada is considered the common programming language for both the US military and NATO.

In addition, Ada is used to build large systems to which high reliability requirements are imposed, such as: control computer systems for aviation (including civil); control computer systems for high-speed railways; banking systems; industrial automation and robotics; Medical equipment; telecommunication systems.

Ada is used in higher educational institutions in the USA and Western Europe, as a basis for learning programming, and is often used in research and development. Ada-program manages the movement of trains without drivers in the Paris Metro. A number of firms specialize in the development of compilers, various libraries and tools, covering a wide range of hardware platforms and operating systems. In addition to commercial development tools, there are freely available compiler versions such as ObjectAda from Aonix or GNAT from Ada Core Technologies.

Ada is the most standardized programming language. The international standard was adopted before the first working versions of translators appeared, thus avoiding the incompatibility of the various dialects of Ada. Ada surpasses SI and C ++ in terms of the rigor of data typing, the flexibility of separate compilation, the ability to create highly reliable real-time systems, the availability of strict control over function parameters and index overruns (80% of errors that occur when creating programs in C / C ++ are related to with this) and machine-independent representation of binary values ​​(instead of bit operations, the retrieval of record fields is performed). At the same time, Ada is semantically and syntactically transparent, so it is easier to learn than Java.

Ada is inferior to C / C ++ in support of new operating systems, as well as in the availability of maintenance tools, debugging and the formation of graphical interfaces. But the language standard includes automatically generated specifications for interfacing with other programming languages, and in practice, together with Ada, Fortran mathematical libraries, system functions written in C, Java classes for working with the Internet are used. Therefore, there are multilingual IDEs that support languages ​​other than Ada, for example, IBM Rational Ada Developer (C / C ++ / Ada).

Ada implements both automatic garbage collection (both in Java or C #) and the ability to reclaim memory directly (as in C, C ++, Pascal). As with C / C ++, there are rich low-level facilities available in Ada. Built-in multitasking support is unique to the Ada programming language and sets it apart from most programming languages. This support is not provided by extensions or external libraries, but by standardized tools that are built directly into the programming language.

If you ask a domestic IT specialist: "What is Hell?", Most will just shrug their shoulders in surprise, and some will even say that this is a dead language, once invented by the Pentagon, but now practically not used. In fact, Ada today is a quite successful programming language that is actively used in various fields. True, most Russian programmers know little about it.

Probably everyone who had to use the fourteenth line of the Paris Metro was surprised when he first saw a train in which there is no driver's cab. The movement of trains on this line is completely controlled by the Ada program.

Despite everything, in some areas of technology, Russia is still "ahead of the rest of the planet." And one of them is the design and production of amphibious aircraft. The internationally recognized leader in this area is TANTK im. G.M. Beriev. The company recently acquired Ada-based onboard software development tools for use in upgrading its latest Be-200 model.

Meanwhile, the majority of domestic IT specialists, at best, do not know anything about the language of Hell, at worst, they have a completely wrong idea of ​​Hell as a monster language, once invented by the Pentagon for the development of military systems, but now completely forgotten.

A bit of history

The official birthday of the Ada programming language can be considered February 17, 1983 - the date of approval of the ANSI / MIL-STD-1815-A-1983 standard.

The technical and administrative measures taken by the Ministry of Defense as part of the project for the creation and implementation of Ada completely prevented the emergence and spread of dialects of the language. From 1983 to the present, all industrial implementations support the current Ada standard. When it comes to Ada subsets, these subsets are determined not by the implementation, but by the development standards for a particular class of systems.

In 1987, the ANSI standard, without a single change, was approved as an ISO standard (ISO / IEC 8652), and when the need to revise the standard became necessary in the early 90s, the revision work was also carried out under the direction and funds of the US Department of Defense. A new international project was launched, which ended with the approval at the end of 1994 and the publication at the beginning of 1995 of a new version of the ISO / IEC 8652 standard. It is this document that serves as the definition of the Ada programming language today.

In the USSR, in the early 80s, a Working Group on the Ada programming language was formed under the State Committee on Science and Technology. All open information about the project was carefully collected and analyzed, and the efforts of special services also extracted classified information. Projects were organized to implement Ada for virtually all computer architectures then in use, and some of them were very successful. The collapse of the USSR put an end to this activity. Today Ada is used in Russia and the CIS by individual enthusiasts.

What is Ada

All modern industrial languages ​​provide essentially the same basic set of capabilities, differing not in what they allow you to do, but in how they allow you to do it. However, Ada expands the set of capabilities standard for modern languages ​​in at least two aspects. First, Ada provides high-level programming tools for asynchronous processes. Secondly, it is the only language that can be called modular without any reservations.

Such an example is simply necessary in order to refute the rather widespread myth that Ada is a large, complex and "heavy" language, suitable only for writing super-large and super-complex systems. In fact, Ada can be used to develop small and medium-sized programs with the same success as modern clones of C, Pascal, BASIC and Java. For example, a classic example of the "Hello, World!" looks like this in Ada:

It is easy to see that the Ada code is similar to the Pascal code that was chosen as its prototype. The first line describes the relationship of this compiled module with other modules - it is indicated that the Hello_World subroutine should be compiled together with the Ada.Text_IO module, which is a component of the predefined library.

The following program defines two asynchronous processes:

The Local Declarations section of the Tasking_Example procedure describes the Outputter task (line 6, lines 8 through 17 contain the body of this task). When control in the process corresponding to Tasking_Example reaches line 20, before executing this first statement, the process corresponding to the Outputter is started, after which the two processes live and execute asynchronously independently of each other. The execution of the delay statement (lines 14 and 20) consists in suspending the corresponding process for the specified number of seconds. Thus, the Tasking_Example process is suspended for 20 seconds, while the Outputter process starts printing the values ​​of the incrementing counter, pausing for one second after each value is output. After 20 seconds, the Tasking_Example process sets the Finished flag to true, which ends the loop in the Outputter process. Specifying the Finished variable as an atomic data object (line 4) makes it impossible to read and change the value of this variable at the same time.

The following is a template for a function that allows component-wise addition of two one-dimensional arrays. This template can be configured for an arbitrary type, which is a one-dimensional array, for whose components assignment and addition operations are defined ("addition" does not have to be arithmetic addition).

Lines 1-6 contain the declaration of the custom function, and lines 8-20 contain its body. Informally, the tuning parameter is an arbitrary one-dimensional regular type with an unspecified index range (line 4), about which it is only known that its component type is arbitrary, but an assignment operation is defined for the components (line 2), the index type is arbitrary discrete (line 4) ... Since we have to add two arrays componentwise, we need to know what the addition operation is for the component type. Since this is an arbitrary type, we are forced to pass addition for the component type as a formal preference (line 5).

In the body of the function, we first check whether the lengths of the operands are the same (line 12), otherwise component-wise addition is meaningless. Matching the lengths of the operands does not guarantee that the index ranges will match, so in a loop over the index range of the first argument (line 15), we need to calculate the index of the corresponding component of the second argument each time. We are deprived of the opportunity to do this for the Index type, since we only know about it that it is discrete, so we pass from the value of the discrete type to its ordinal number (the? Pos attribute), calculate the necessary shift for the ordinal number and return to the corresponding value of the Index type ( the? Val attribute).

Note that the parameters of the (custom) function "+" Left and Right are declared to be of type Arr, the index range of which is not specified. However, Left and Right are formal parameters, in their place, when calling (the result of instantiation) of the "+" function, specific arrays with known index ranges will be substituted. In the body of the "+" function, we use array attributes (? Range,? First,? Length) to get information about its index range from the object.

Why Ada?

Choosing a language for a software project was previously a purely technical issue. Today it has become a matter of strategic importance with far-reaching implications for the success of the project. Let's list some of the reasons due to which the Ada language was chosen for the implementation of software projects by various companies, or made mandatory for use in tenders.

  • The desire to increase the reliability of the system being developed, since software defects can have serious consequences for human health, economy, ecology, etc. (Ada has built-in security features.)
  • Desire to reduce the cost of developing and maintaining the system.
  • Availability of international standards and availability of language compilers for almost any platform.
  • The benefits of a disciplined approach to software development, which become especially significant as the volume and complexity of software increases.
Ada and C

When conducting comparative analyzes of popular languages, so many copies were broken that today this topic is often referred to the category of "religious wars". Therefore, we will limit ourselves only to a reference to a well-known article, which draws a number of eloquent conclusions.

  1. Development of programs in the Ada language costs 60% less than similar software projects implemented in C.
  2. An Ada program has 9 times fewer defects than a C program; a C ++ program has even lower characteristics than a C program.
  3. preferable to C for both experienced and inexperienced programmers, as well as for programmers who have both the maximum and minimum ratings in their group.
  4. The complexity of studying the language of Hell is not higher than the complexity of studying C.
  5. Ada programs are more reliable than C programs.

To illustrate these conclusions, we will give an example of the development of onboard software for a C-130J aircraft in accordance with the requirements of Level A of the DO-178B standard. At the same time, the quality of the code was stated, which was 10 times higher than the average for Level A software. Labor productivity increased fourfold relative to comparable software projects.

Ada and Java

Microsoft was forced to include the following clause in the licensing agreements for its operating systems ( www.microsoft.com/msdownload/ieplatform/ie/ license.txt): “Java language support note ... Java technology is not fault tolerant and is not intended ... for use in real-time control systems ... where Java language failure could result in death, injury, or severe damage to infrastructure or the environment. Sun Microsystems, Inc. obliged Microsoft to post this warning. "

Let us also point out the articles and, demonstrating the advantages of the Ada language over Java.

"Infernal" myths

Quite often, a set of persistent misconceptions is associated with Ada that impede both the spread of the language and the conscious choice of Ada as the language for project implementation.

Ada is a dead language, no one programs in it now. In fact, Ada is confidently occupying the niche of large embedded systems with increased reliability requirements. Compared to "boxed" products for Windows, such systems are not so noticeable, since they either exist in one copy (what's the point of replicating the program that controls the movement of subway trains), or distributed as part of the system in which they are embedded (onboard software).

Ada is a language designed exclusively for military applications. Ada was indeed developed with the assistance of the US Department of Defense, but there are no technical, administrative or other reasons preventing the use of Ada for the development of civilian systems. The number of "civilian" projects based on this language today is comparable to the number of "military" projects.

Ada is too large and complex a language to use in a small project. The volume and complexity of all modern industrial languages ​​is practically the same, and to be convinced of this, it is enough to simply compare the volume of their descriptions. This myth dates back to the early 1980s, when Ada was compared to Pascal, Fortran 77 or BASIC.

There are few programmers who know Ada; learning a language from scratch requires excessive effort and time. In fact, the real difficulty is finding specialists who understand the specifics of embedded systems and are able to create high-quality programs for them. For example, BAE, one of the active users of the Ada language, does not require candidates to know this language; instead, people familiar with embedded systems and industrial-quality software development processes are sought. After hiring such people, it only takes two weeks to teach them the language of Hell.

Our personal experience shows that programmers familiar with this or that kind of Pascal need only a few days to start developing simple programs in Ada.

The existing Ada technologies are ineffective; both translators and the code they generate have poor performance. This myth also dates back to the first half of the 80s, when the first implementations of Ada appeared, in fact, just proving the "theorem of existence of the Hell-translator corresponding to the standard." It is enough to carry out a number of simple experiments, programming some model problem in Ada, Pascal and C / C ++, and then comparing (with comparable compiler parameters) the compilation speed, the amount of generated code and the speed of its execution to make sure that any specific inefficiency inherent in Hell simply does not exist. It can also be noted that the GNAT programming system, with a source code of more than 40 MB, is 90% implemented in Ada, and its construction from the source code (in its course it compiles itself three times) on a modern PC takes no more than half an hour.

Ada's existing implementations are extremely expensive. This is true, however, it should be borne in mind that there is a publicly available version of the GNAT programming system, which can be freely and legally taken from the software repository of New York University ( ftp://cs.nyu.edu/pub/gnat) along with the sources

Free cheese and how to avoid the mousetrap

GNAT (GNu Ada Translator) is a multi-platform implementation of the Ada language that exists on almost all modern industrial platforms and supports code generation for popular embedded architectures. GNAT ( www.gnat.com) fully implements the Ada standard, including those libraries that are classified as optional by the standard. In addition to the HADA translator itself, GNAT includes a toolkit, in which it should be noted a developed integrated development environment and a multilingual graphical debugger, which allows, among other things, to investigate the behavior of programs with asynchronous processes. The translator and accompanying tools can be used both separately, calling them from the command line, and within the framework of the integrated graphical development environment for Ada programs. All GNAT components, including the development environment, have the same interface on all platforms. In addition to fully implementing the features described by the standard, GNAT offers a rich set of extensions that the standard allows. GNAT is an implementation of Ada in the gcc multilingual programming system, consisting of a set of front-end compilers for different input languages ​​with a common code generator, which greatly simplifies the development of programs containing components implemented in different programming languages.

GNAT was developed and distributed from the beginning under the GPL license. Alas, there are many myths associated with the GPL. For example, many people think that GPL-covered programs are developed by unorganized groups of enthusiasts and are distributed absolutely free of charge; as a result, both the reliability and functionality of such programs leave much to be desired, do not allow them to be used in any serious projects. This is far from the case with GNAT. In order to be convinced of this, it is enough to look at the list of companies that have entered into contracts for technical support with its developers: Boeing, British Aerospace, Lockheed, Ericsson, SAAB, Avionics, etc.

Providing free demos is a common practice for many software developers. GNAT differs in that the publicly available public version is an absolutely complete version of the technology, without any legal or technical restrictions on its use. A number of serious projects have been successfully implemented on the basis of public versions of GNAT. The software of the Beagle 2 lander of the European automatic station Mars Express, currently heading to Mars ( www.beagle2.com/index.htm), automated station of documentary communication of the Ministry of Defense of the Russian Federation ( www.ada-ru.org/prj_doc.html). The only drawback of public versions is that the developer does not provide technical support for them.

Conclusion

To summarize, the Ada language provides developers with the perfect combination of integrity, consistency, reliability, and efficiency. The language supports creative creativity and innovation, while providing the discipline and industrial level of software development necessary to implement software systems of great importance.

Literature
  1. Benjamin Brosgol, Introduction to Ada 95. www.embedded.com/story/OEG20021211S0034
  2. Stephen Zeigler, Comparing Development Costs of C and Ada. www.adaic.com/whyada/ada-vs-c/cada_art.html www.ada-ru.org... An annotated bibliography of books on the language of Hell, published in Russian, can be found on the website

Abstract on the topic:

Ada



Plan:

    Introduction
  • 1 Language features
  • 2 "Hello, world!" in Hell
  • 3 History
  • 4 Hell in the USSR and Russia
  • 5 Criticism
  • 6 Distribution, perspectives
  • 7 Operating systems written in Ada
    • 7.1 Embedded systems
    • 7.2 Systems in development
    • 7.3 No longer existing systems
  • 8 Compilers of Hell
  • 9 Derived languages
  • 10 Interesting Facts
  • Notes (edit)
    Literature

Introduction

Hell (Ada) is a programming language created in 1979-1980 as a result of a project undertaken by the US Department of Defense with the aim of developing a unified programming language for embedded systems (that is, control systems for automated complexes operating in real time). They meant, first of all, onboard control systems for military objects (ships, aircraft, tanks, missiles, shells, etc.). The developers were not faced with the task of creating a universal language, so the decisions made by the authors of Ada must be perceived in the context of the peculiarities of the chosen subject area. The language is named after Ada Lovelace.


1. Features of the language

In its original version, standardized in 1983, Ada is a structured, modular programming language that contains high-level programming tools for parallel processes. Ada's syntax is inherited from languages ​​like Algol or Pascal, but expanded, and also made more strict and logical. Ada is a strongly typed language, it excludes working with objects that have no types, and automatic type conversions are reduced to an absolute minimum. In the 1995 standard, the basic object-oriented programming tools were added to the language, in the 2007 standard these tools were supplemented, so modern Ada is an object-oriented programming language.

Of the features of the syntax, it can be noted:

  • The language is case-insensitive.
  • The programs are modular, the mechanism for controlling the import-export of descriptions between modules includes two different directives: one for connecting another module (with), the other for importing its descriptions (use). It is also possible to rename the module during import (rename) - this option allows you to use more convenient identifiers for the package designation.
  • Packages (one of the types of modules) can contain a header and a personal part - what is contained in it is not exported and is not available to other modules.
  • The mechanism of generalized (customizable) modules is supported: packages, procedures and functions that allow describing generalized data processing algorithms without specifying a specific type.
  • A developed system of types, both built-in and generated by the programmer. There are many ways to create new types, the language supports two different concepts: "subtype" and "derived type". Variables of type and subtype are compatible, variables of type and its derived type are not.
  • Exception handling facilities.
  • Advanced means of referring to procedures and functions: input and output parameters are supported, transfer of actual parameters in an arbitrary order with the indication of formal names, parameters with default values.
  • Overriding procedures, functions and operators is supported - creating several variants of a procedure, function or operator with the same name, but different signatures (types and number of parameters).
  • Constructs built into the language to support parallel programming: the concepts of "task" (a program fragment executed in parallel), "task input" (a means of synchronization and communication of parallel running tasks) are supported; ), there is a SELECT operator for organizing conditional inter-thread interaction (selection of a parallel task with which to interact, depending on the readiness for a rendezvous and some other conditions). In principle, the parallel programming tools available in the language are sufficient to solve a large class of tasks that require parallel processing, without resorting to external tools, such as additional libraries or operating system APIs.

To meet the reliability requirements, the language is built in such a way that as many errors as possible are detected at compile time. In addition, one of the requirements in the development of the language was the maximally easy readability of the program texts, even at the expense of the ease of writing. The result of this approach was a somewhat "heavyweight" syntax and many restrictions that are absent in the most common industrial languages ​​(C and C ++) and are often perceived by professional programmers as redundant, for example, the same strong typing. This led to the formation of the idea of ​​Ada as a complex, obscure and inconvenient language to use.


2. "Hello, world!" in Hell

Several different variants of the program "Hello, world!" can be seen in the Wikibooks. The differences are due to the need to use the Put_Line library function - there are three different ways of organizing this use in this language.

With Ada.Text_IO; procedure Hello is use Ada.Text_IO; begin Put_Line ("Hello, world!"); end Hello;

Here, to use the Put_Line function, the Ada.Text_IO package containing it is imported using the use construct, which makes it possible to call the function by name without qualification - specifying the name of the package containing the function in the call.


3. History

The development of the language was carried out as part of an international competition organized and funded by the US Department of Defense. The goal of the development was to obtain a programming language that could become a uniform for the development of projects ordered by the military department, mainly for the development of embedded systems for military purposes and for large military computers (based on the iAPX 432 processor from Intel). The work began in 1975, with the formation of a set of requirements for the language, which would fully satisfy the developers of systems of this type. The initial list of requirements, issued under the code name "Straw", was submitted for review to a number of organizations and firms, was consistently refined for two years, eventually turning into a final document called "Steel".

After the completion of the formation of the requirements, an analysis was carried out, which showed that none of the available programming languages ​​satisfies the requirements sufficiently, so it was decided to develop a new language. A competition for its creation was announced in 1977, the developers were asked to be based on one of three languages: Pascal, Algol-68 or PL / 1.

Of the 15 projects submitted for the competition, 4 were selected (all based on Pascal). These projects were sent for further revision. At the next stage, out of 4 projects, two were selected, of which, after the next revision, one was selected. This language was named "Ada" - the group that developed it under the leadership of the Frenchman Jean Ishbia gave the language a name in honor of Augusta Ada King Lovelace (1815-1852), the daughter of the poet J. Byron, who developed programs for Babbage's computer and is considered the first programmer in the world.

In 1983, the language was officially standardized by ANSI. The ANSI / MIL-STD-1815-A-1983 language standard was approved on February 17, 1983. The US Department of Defense has registered the name "Ada" as a registered trademark, banning translators of the language that have not passed formal compliance testing. The procedure consisted of running a large number (more than 1000) of test programs (the so-called ACVC suite) through the compiler under test, for each of which the test result was uniquely determined: either a successful compilation or a very specific error message. Testing was carried out on the "all or nothing" principle - if at least one test case was processed, the compiler was considered to have failed the test, and the testing was valid only on the hardware and software platform on which it was carried out. Thus, the possibility of the formation of "versions" or "dialects" of the language of Hell was suppressed in the bud.

In 1987, the language of Ada was officially standardized by ISO. From that moment on, the US Department of Defense made the language available to the public.

By 1990, there were about 200 compilers in the world that corresponded to the Ada language standard.

In 1995, a new Ada standard was adopted, known as Ada95. Object programming tools were introduced into the language. In addition, the language was supplemented with more advanced means for interacting with programs written in other languages.

In March 2007, changes to the Ada standard were published. They mainly touched upon the possibilities of object-oriented programming: interfaces were introduced, the syntax for calling a method that was usual for most hybrid languages ​​was adopted, and a number of additions were made.


4. Hell in the USSR and Russia

In the USSR, in the 1980s, a Working Group on the language of Hell was organized under the State Committee for Science and Technology. The group was engaged in the study of all open (and, according to rumors, obtained by intelligence closed) data on the language of Ada and investigated the possibility and feasibility of the development and use of Ada in the USSR. The activities of this group led by the end of the 1980s to the development of Ada compilers for practically all computers used in the USSR. Several books on the language of Hell have been published in Russian.

At Moscow State University, work was carried out to create its own test packages for Ada-translators for compliance with standards. At LSU, to create the Ada-system, the Pallada system, previously developed for the implementation of Algol-68, was used, which was transferred to Ada. The system contains an integrated development environment, a compiler, a text editor, a debugger, libraries, a version control system, and a command interpreter.

After the collapse of the USSR, work on the spread of Ada was practically interrupted. True, three programs for the development of software development in Ada were adopted (in the Ministry of Defense, the Ministry of Civil Aviation and the Ministry of Education and Science), but their development is being carried out slowly and uncoordinated. As a result, the Ada language is little known in Russia, the majority of modern Russian programmers consider it a "dead language" and do not know anything about it. Ada is used in Russia and the CIS by individual enthusiasts. Nevertheless, the language is used for industrial software development. There are several known projects developed in Ada working in Russia. Among them:

  • Station of documentary communication of the Ministry of Defense of the Russian Federation. The main task is to ensure the exchange of documentary information in the data transmission networks of the Ministry of Defense of the Russian Federation. The hardware and software complex was jointly developed by the Computing and Automation Production Organization (hardware) and a group of programmers in the off-track sector of the Strela North Caucasus Air Traffic Control Center. The software of the complex is written in the Ada programming language using the GNAT compiler. Distributed computing is supported by the GLADE add-on component.
  • Complex of standard flight-navigation and communication equipment for Russian amphibious aircraft Beriev Be-200... The development was carried out by the Scientific Research Institute of Aviation Equipment in Zhukovsky, together with the American firm Allied Signal, Florida, USA. The complex for the development of Ada-systems of the DDC-I company on the Intel 80486 platform was used.

5. Criticism

Since its inception, Ada has been criticized by some recognized authorities in the development of programming languages, primarily for the complexity of the syntax and the large volume. In particular, the language was criticized by Charles Hoare and Niklaus Wirth (who participated with their project in this competition, but dropped out after the first stage), as well as Edsger Dijkstra.

Dijkstra doubted that a language of such complexity as Ada could be observable and manageable.

If Ada is going to issue a standard, it is desirable that it be explicitly documented. At least two groups have tried to do this; as a result, both produced about 600 pages of formal text. This is much more than is necessary to ensure that it is impossible to even firmly establish that both documents define the same language. The error of the obvious unmanageability of these two documents lies not in the two groups that compiled them, not in the formalism they adopted, but only in the language itself: without providing a formal definition of whether its developers can hide that they are proposing an uncontrollable monster. That Ada will reduce programming problems and increase the reliability of our designs to acceptable limits is just one of those fairy tales that only people with a military background can believe.

Science fiction and scientific reality in computer science (Edsger W. Dijkstra, EWD952)

Hoare expressed his regret that "rattles and trinkets have prevailed over the fundamental requirements of reliability and safety" and warned against "an armada of missiles flying in the wrong direction due to an oversight of a bug in Ada's compiler." Niklaus Wirth spoke more restrainedly, but also negatively. He said: “Too many things fall on the programmer. I don't think that after studying a third of Ada, you can work normally. If you do not master all the details of the language, then in the future you can stumble on them, and this will lead to unpleasant consequences. " Jean Ishbia, Ada's development team leader, expressing his "respect and admiration" for Wirth, disagreed with him, saying, "Wirth believes in simple solutions to complex problems. I don't believe in such miracles. Complex problems require complex solutions. "

The procedure for checking the compiler's compliance with the language standard by testing also raises doubts. It is clear from general considerations that testing can find inconsistencies, but cannot guarantee correctness. A practical confirmation of this is the fact that certified compilers, when tested on a different set of tests, found non-compliance with the standard.

Ada proponents argue that the only alternative to a large and complex language in large projects is the use of several compact languages, which inevitably creates the compatibility problems that Ada was designed to get rid of. They also notice that the idea of ​​the complexity of developing in Ada is only partially true: writing a simple program in Ada does take more time than in other less formal languages ​​such as C, but debugging and maintaining programs, especially large and complex ones, is much easier. According to Stephen Zeiger of the Rational Software Corporation, software development in Ada is generally 60% cheaper, and the developed program has 9 times fewer defects than using the C language.


6. Distribution, perspectives

In practice, it turned out that Ada, having occupied its intended niche in the military and related developments of embedded systems, did not go beyond this niche, neither in the West, nor in the USSR, nor in the post-Soviet space. There are many reasons for this. Opponents of the language emphasize its complexity and shortcomings, supporters speak, first of all, about the objective circumstances of the emergence of the language and the negative aspects of the process of its implementation. Interesting is the opinion of S. I. Rybin, senior researcher at the Research Computing Center of Moscow State University, consultant to AdaCore EU, an expert on the Ada language of the ISO working group on the language standard. He believes that Ada owes her failures to two main reasons:

  • During the design of the language, the Pentagon assumed that all new software would be created only in Ada. Because of this, Ada received extremely primitive means of interacting with programs in other languages. In practice, it turned out that writing everything in Ada in general is unrealistic (if only because there was a need to interact with ready-made developments in other languages). Therefore, in industries where there was no strict requirement to "write only in Ada", other languages ​​were preferred, more adapted to a multilingual environment. In the 1995 standard, the problem of interoperability with other languages ​​was solved, but time was lost.
  • Paradoxically, the financial and organizational support of the Pentagon prevented the spread of Ada. The Ada programs written for the military ran on the most powerful computing hardware available, so the compiler developers cared first about passing the ACVC tests, and only then about the efficiency of the compiler and the code it generated. In the early 1980s, a microcomputer boom began, and translators for common languages ​​(Pascal, C, BASIC) were quickly optimized for low-power systems. For Ada, there was no incentive for such modernization, as a result, personal computers that became in a few years the bulk of the world's computing park were without a high-quality translator of Ada. Naturally, Ada lost this market segment. Only relatively recently did the GNAT compiler appear, high-quality and efficient, but here too the time was lost.

At present, Ada is quite firmly established in the development of large embedded systems of increased reliability, here she has practically no strong competitors. The use of the language is gradually increasing, albeit rather slowly. According to some cautious forecasts [ ], with the reduction in the cost of hardware and the spread of embedded systems with complex software, the market for programs in Ada may grow noticeably, and the use of the language will also grow.

In addition, Ada has, albeit very limited, application in the field of higher education. Special courses on Ada are taught at Moscow State University and Kharkov University. However, according to the same S.I. Rybin,

... now in the post-Soviet space in the field of the software industry and education, an obvious vicious circle has developed: the industry practically does not know about Ada, respectively, from the industry there is no demand for education to train Ada specialists, and new people come from universities to the industry, who know practically nothing about Hell.


7. Operating systems written in Ada

7.1. Embedded systems

  • MaRTE
  • RTEMS - open source OS, developed by DARPA US Department of Defense
  • Ravenskar
  • RTOS-32 - proprietary OS

7.2. Systems in development

  • AuroraUX (a project to rewrite the OpenSolaris kernel, and then DragonFly BSD into the Hell language)
  • Lovelace (operating system on the L4 core)

7.3. No longer existing systems

  • BiiN ™
  • Pulse ™
  • AdaOS

8. Hell compilers

Name Company Version Operating system Website
AdaMagic SofCheck Ada 95 ? www.sofcheck.com
AdaMULTI Green Hills Software Ada 83, Ada 95, C, C ++, Fortran Solaris SPARC, GNU / Linux x86, Windows www.ghs.com
DEC Ada Hewlett Packard Ada 83 OpenVMS h71000.www7.hp.com
GNAT AdaCore Ada 83, Ada 95, Ada 2005, Si Solaris SPARC, Linux x86 / x86-64, Windows, others libre.adacore.com
ICC Irvine Compiler Corporation Ada 83, Ada 95 DEC VAX / VMS, HP 9000/700, Solaris SPARC, DEC Alpha OSF / 1, PC Linux, SGI IRIX, Windows www.irvine.com
Janus / Ada RR Software Ada 83, Ada 95 SCO, UnixWare, Interactive, MS-DOS, Windows www.rrsoftware.com
MAXAda Concurrent Ada 95 Linux / Xeon, PowerPC www.ccur.com
ObjectAda Aonix Ada 95 Solaris SPARC, HP-UX, IBM AIX, Linux, Windows www.aonix.com
PowerAda OC Systems Ada 83, Ada 95 Linux, AIX (Ada 95); IBM System 370/390 (Ada 83) www.ocsystems.com
Rational Apex IBM Rational Ada, C, C ++ Solaris SPARC, Linux www-01.ibm.com
SCORE DDC-I Ada 83, Ada 95, Si, Fortran Solaris SPARC, Windows www.ddci.com
XD Ada SWEP-EDS Ada 83 OpenVMS Alpha / VAX www.swep-eds.com
XGC Ada XGC Software Ada 83, Ada 95, Si Solaris SPARC, PC Linux, Windows (Cygwin) www.xgc.com

With the exception of GNAT and XGC (for some platforms), the above compilers are paid. Some firms, such as Aonix, offer free demos that are limited either in time of use or in functionality.

The NetBeans and Eclipse IDEs have plugins for working with Ada.


9. Derived languages

The syntax of the Ada language is used in languages ​​such as:

  • PL / SQL

10. Interesting facts

  • Formally, the competition for the development of the language, as a result of which the Ada language was created, was anonymous - groups of developers presented their projects under code names so that the competition committee could not take into account the personality of the developers when choosing the winner. But in practice, as one of the members of the commission wrote, the tastes of the developers were so different that it was not difficult to identify the author of the project.
  • All languages ​​that have come down to the last rounds of this competition were based on Pascal. In this regard, Ada can be tentatively characterized as Pascal, developed taking into account the given five basic requirements. At the same time, the authors went mainly along the path of expanding Pascal with new elements. The result is a significantly more complex language.
  • In the Russian language, there are jokes associated with the ambiguity of the expression "The Language of Hell", including those based on a parallel with the Russian Algorithmic Language, also known as the "Language of PARADISE". The programming folklore also included the conclusion of an article by Soviet propagandist Melor Sturua (1984):

The language of the Pentagon is the enemy of the world. The language of "Ada" is the voice of a thermonuclear hell ... In the language of "Ada" a curse is heard to the human race.


Notes (edit)

  1. Reference guide to the language of Ada 83. Chapter 1.3. Purposes and sources of development - www.ada-ru.org/arm83/ch01s03.html
  2. Vadim Stankevich. Lady Hell - www.kv.by/index2006451104.htm
  3. Updated standard on iso.org - www.iso.org/iso/en/CatalogueDetailPage.CatalogueDetail?CSNUMBER=45001
  4. Bryabrin VM Software for personal computers. Moscow: Nauka, 1988.
  5. 1 2 S. I. Rybin's interview - www.ada-ru.org/wiki/rybin
  6. , Object-Oriented Programming Languages, NET Platform Programming Languages, Ada, Ada Code Sample Articles.
    Text available under the Creative Commons Attribution-ShareAlike license.