Want to know everything. Language of Hell


If you ask a domestic IT specialist: “What is Ada?”, most will only shrug their shoulders in surprise, and some will even say that it is a dead language, once invented by the Pentagon, and now practically not used. In fact, even today Ada is a completely prosperous 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 they first saw a train in which there was no driver’s cabin. The train movement on this line is completely controlled by the Ada program.

Despite everything, in certain areas of technology Russia is still “ahead of the rest.” And one of them is the design and production of amphibious aircraft. The internationally recognized leader in this field is TANTK named after. G.M. Beriev. The company recently acquired Ada-based avionics software development tools for use in upgrading its latest Be-200 model.

Meanwhile, the majority of domestic IT specialists, at best, know nothing about the Ada language, and at worst, have a completely incorrect idea of ​​Ada as a monster language, once invented by the Pentagon for the development of military systems, and now completely forgotten.

A little 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.

Technical and administrative measures taken by the Ministry of Defense as part of the project to create and implement 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 of a particular class of systems.

In 1987, the ANSI standard was adopted without a single change as an ISO standard (ISO/IEC 8652), and when the need for revision of the standard became necessary in the early 1990s, 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 today serves as the definition of the Ada programming language.

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 classified information was also obtained through the efforts of special services. Projects were organized to implement Ada for almost all computer architectures in use at that time, and some of them turned out to be 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 exactly they allow you to do it. However, Ada, in at least two respects, extends the standard set of capabilities for modern languages. 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 fairly 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. So, a classic example of the program “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 indicates that the Hello_World routine 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 the Tasking_Example procedure reaches line 20, the process corresponding to the Outputter task is started before executing this first statement, after which the two processes live and execute asynchronously independently of each other. The execution of the delay statement (lines 14 and 20) consists of suspending the corresponding process for the specified number of seconds. Thus, the Tasking_Example process is suspended for 20 seconds while the Outputter process begins printing incremental counter values, pausing for one second after each value is printed. After 20 seconds, the Tasking_Example process sets the Finished flag to true, ending the loop in the Outputter process. The specification of the Finished variable as an atomic data object (line 4) makes it impossible to simultaneously read and change the value of this variable.

Below is a function template that allows you to add two one-dimensional arrays componentwise. This template can be set to an arbitrary type that is a one-dimensional array whose components have assignment and addition operations defined (the addition need not be an arithmetic addition).

Lines 1-6 contain the declaration of the custom function, and lines 8-20 contain its body. In essence, the setting 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 the assignment operation is defined for components (line 2), the index type is arbitrary discrete (line 4) . Since we are going 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 the addition for the component type as a formal setting parameter (line 5).

In the body of the function, we first check whether the lengths of the operands are the same (line 12), otherwise componentwise addition does not make sense. Matching operand lengths does not guarantee matching index ranges, 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 unable to do this for the Index type, since we only know about it that it is discrete, so we go from the value of the discrete type to its ordinal number (attribute?Pos), calculate the necessary shift for the ordinal number and return to the corresponding value of the Index type ( attribute?Val).

Note that the parameters of the (custom) function "+" Left and Right are declared to be of type Arr, the index range of which is unspecified. However, Left and Right are formal parameters, in whose place, when calling (the result of concretization) 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 obtain information about its index range from the object.

Why Ada?

Choosing a language for a software project used to be a purely technical matter. Today this has become a matter of strategic importance, with far-reaching consequences for the success of the project. Let us list some of the reasons why the Ada language was chosen for the implementation of software projects by various companies, or made mandatory for use within tenders.

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

When conducting comparative analyzes of popular languages, so many copies have been broken that today this topic is often classified as “religious wars.” Therefore, we will limit ourselves to just a reference to a well-known article, which makes a number of eloquent conclusions.

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

To illustrate these conclusions, we give an example of the development of on-board software for the 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 10 times higher than the average for Level A software. Labor productivity increased fourfold compared to comparable software projects.

Ada and Java

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

We will also point out articles and that demonstrate the advantages of the Ada language over Java.

"Hell" myths

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

Ada is a dead language; no one programs in it now. In fact, Ada confidently occupies 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 is the point of replicating a program that controls the movement of subway trains), or are distributed as part of the system in which they are built (on-board software).

Ada is a language intended exclusively for military applications. Ada was indeed developed with the participation 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 is today 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 ​​are almost 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 80s, when Ada was compared to Pascal, Fortran 77 or BASIC.

There are few programmers who know Ada; learning the 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 are sought out who are familiar with embedded systems and processes for creating industrial-quality software. After hiring such people, it only takes two weeks to teach them the language of Hell.

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

Existing Ada technologies are ineffective; Both translators and the code they generate are characterized by low performance. This myth also dates back to the first half of the 80s, when the first implementations of Ada appeared, which in fact just proved “the theorem of the existence of an Ada translator that complies with the standard.” It is enough to conduct a series of simple experiments by programming some model problem in Ada, Pascal and C/C++, and then comparing (with comparable compiler parameters) the compilation speed, the volume of generated code and the speed of its execution to make sure that there are no specific inefficiencies , characteristic of Ada, simply does not exist. It can also be noted that the GNAT programming system, with a source text volume of more than 40 MB, is 90% implemented in Ada, and building it from source texts (during its course it compiles itself three times) on a modern PC takes no more than half an hour.

Existing Ada implementations are extremely expensive. This is true, but keep in mind that there is a publicly available version of the GNAT programming system that can be obtained freely and legally from the NYU software repository ( ftp://cs.nyu.edu/pub/gnat) along with the source texts

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 Ada translator itself, GNAT includes tools that include a developed integrated developer environment and a multilingual graphical debugger, which allows, among other things, to examine the behavior of programs with asynchronous processes. The translator and related tools can be used either individually, calling them from the command line, or as part 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 the full implementation of the tools described by the standard, GNAT offers a rich set of extensions allowed by the standard. GNAT is an implementation of Ada in the gcc multilingual programming system, consisting of a set of front-end compilers for various input languages ​​with a common code generator, which greatly simplifies the development of programs containing components implemented in various programming languages.

GNAT has been developed and distributed under the GPL license from the very beginning. Unfortunately, there are also a lot of myths associated with the GPL. Thus, many believe that programs under the GPL are developed by unorganized groups of enthusiasts and distributed absolutely free of charge; As a result, both the reliability and functionality of such programs leave much to be desired and do not allow their use in any serious projects. In the case of GNAT this is far from true. To verify this, just look at the list of companies that have entered into technical support contracts with its developers: Boeing, British Aerospace, Lockheed, Ericsson, SAAB, Avionics, etc.

Providing demo versions freely is a common practice of many software developers. GNAT is different in that the freely 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. Software of the Beagle 2 lander of the European automatic station Mars Express, currently heading to Mars ( www.beagle2.com/index.htm), automated documentary communication station of the Ministry of Defense of the Russian Federation ( www.ada-ru.org/prj_doc.html). The only drawback of the public versions is that the developer does not provide technical support for them.

Conclusion

To summarize, the Ada language provides developers with the ideal combination of integrity, consistency, reliability and efficiency. The language supports creative creativity and innovation while providing the discipline and industrial level of software development needed 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 Ada language published in Russian can be found on the website

Sergei Bobrovsky

The history of this language does not begin in 1975, when the US Department of Defense (DoD) decided to begin developing a unified programming language for the American armed forces, and subsequently for the entire NATO. Its history begins with the name, for Ada is the name of Augusta Ada Lovelace, considered the first programmer, the daughter of the English poet Byron and a certain Anabella Milbank, with whom her husband separated forever a month after the birth of her daughter, who was born on December 10, 1815. In general, the history of cybernetics is shrouded in a dark mystery, and only from fragmentary facts can one judge that the founders of this science in the last two hundred years were various mystics and occultists, starting from Augustus de Morgan, one of Ada’s teachers, and ending with the associates of Norbert Wiener, who studied methods of forming public opinion and its manipulation.

After Charles Babbage built his mechanical computer, Ada wrote the first program for calculating Bernoulli coefficients. Subsequently, she developed a real theory of programming, introduced the concept of a cycle and several other key terms that students of cybernetic faculties study almost verbatim today! Today Ada is known to everyone as the first programmer - and that’s all, but one wonders where a young girl gets such unique abilities? She herself answered this question frankly: “I swear to the Devil that within 10 years I will suck a certain amount of life blood from the mysteries of the Universe, and in a way that ordinary mortal minds and lips could not do. No one knows what terrifying energy and strength lie still unused in my small flexible creature...". However, there were no sponsors for the computer project - there were no nuclear missiles yet, and Ada, having lost all her fortune at the races and got into a dirty story, died at the age of 37, like her famous father.

Therefore, whether the Americans should have praised Ada so much, using her name as the name for such an ambitious project, is a highly controversial issue.

But let's return to the history of the language itself. Five years after the start of the project, hundreds of experts selected from 17 options the only language that satisfied the requirements of ML, developed by a small team led by the talented scientist Jean Ishbia. The final version of the international standard ISO 8652:1987 was published in 1987. According to official reports, all the best programming specialists in the world participated in the creation and refinement of this language, which, however, raises doubts. This, for example, is confirmed by the absence of the concept of an object in the original version of Ada and the non-participation, for obvious reasons, of Soviet programmers in this project.

Tens of billions of dollars have been invested in developing Ada's infrastructure around the world. This led to the emergence of ambitious statements such as “The 20th century will pass under the sign of Ada,” however, as usual, life put everything in its place.

Unfortunately for the US Department of Defense (and, accordingly, fortunately for America’s “potential adversaries”), the development of a clear standard for this language and the creation of effective compilers were completed precisely at the time (early 80s) when the software industry began to emerge on the horizon a new C++ language with an object ideology. Now it is difficult to say what the Ada development committee felt, seeing how the popularity of C++ and the old, well-forgotten, object-based thinking paradigm was growing. But the allocated funds had already been spent, the standard had been created, and there was no turning back.

The structure of Ada is very similar to Pascal, and more precisely, to Modula. The syntax of most statements and descriptions is almost identical to the syntax of Modula, although it appeared almost at the same time as Ada, and it is difficult to say who influenced whom, if at all. In Ada, in particular, quite a lot of different extensions were added, so this language cannot be called compact in comparison with Pascal. In terms of the number of possibilities, it is more likely to resemble PL/1. But since the creators of Ada placed the main emphasis on meeting the wishes of the American “first departments,” the means of data closure (visibility) and the ability to create separate blocks using only specifications (interface descriptions of modules) of other developers were the most advanced for their time. For example, the programmer who actually wrote the code to calculate the flight path of a cruise missile had no idea where and for what purposes his module would be used, although he had access to the required specifications of other employees and could debug his section of the code without any problems. Due to the strict differentiation of access to different levels of specifications, it is sometimes even impossible to determine why and by what means a given procedure will be called. However, this desire for independent program development led to a very complex system of relationships between module specifications and the appearance of some “holes” that could cause side effects, the presence of which, however, was even considered useful by the US Department of Defense.

Elements of data typing have been significantly strengthened, and the types themselves have been more formalized. All I/O functions were removed from the standard syntax, and exception handling became an integral part of the language. In addition, the power of control structures was brought to the limit, which made Ada the most advanced among other Pascal-like languages.

Borland soon released its Turbo Pascal, in which the concept of a module was built-in, and brought its version of Pascal closer in capabilities to Ada, but fortunately, no further attempts were made to create 3rd generation non-objective programming languages ​​intended for the development of very large projects. Therefore, Ada marked the end of a long line of simple procedural languages, starting with Fortran and Algol. In fact, everything that could be imagined within the framework of the ideology of structured programming was embodied in Hell. Then object programming exploded and Ada faded into the background.

However, this language still occupies one niche in which it has no equal yet. In addition to separate compilation of modules and ensuring hierarchical secrecy of specifications, this language implemented such a property as support for parallel programming. Undertaken at a more or less high level in ALGOL-68, then developed in Module-2, it was embodied in very powerful Ada tools, so-called tasks that can be executed independently of each other on parallel computers. This led to the birth of an entire programming ideology based on tasks that could be performed “pseudo-parallel” - on a computer with a single processor. At the same time, the problem being solved was divided into a set of simultaneously working procedures that independently interacted with each other. This was a little reminiscent of the way to solve a problem in Prolog: a certain virtual world is simply described, and then it is, as it were, “launched” into operation, and the solution is found by itself.

It is all the more surprising that the US Department of Defense, for one reason or another, abandoned the objective ideology that was perfectly embodied in

60s in Simula-67, and probably regretted it more than once. True, a certain pathetic replacement for a number of possibilities provided by object-oriented programming was introduced into the Ada language - the so-called templates, that is, procedures with parameters of undefined types. But still, the main advantages of Ada, which allow it to withstand the onslaught of more developed languages ​​today, were, in addition to powerful funding, built-in support for parallel execution of tasks and powerful means of coordinating their interaction. It should be noted that Ada’s main focus is not accounting automation systems in the US Department of Defense, but purely combat missions such as, for example, real-time microprocessor navigation of a homing missile, where it is necessary to simultaneously process information continuously received from a variety of different sensors . Previously, such tasks were written in assembler, which led to many errors and maintenance difficulties. For such tasks, Ada, of course, is perfectly suited.

However, Ada continues to be positioned as a good tool for developing large software systems. True, now the voices in support of this language sound quieter, something like this: “Ada, at least, is no worse than C.” The US Department of Defense, taking into account its main mistake - the lack of objects, in accordance with modern requirements for program development technology, developed a new language standard ISO/IEC 8652:1985(E). It describes the Ada95 (or Ada9X) version of the language. The most interesting thing is that this version is the world's first object-oriented programming system, for which an international standard was introduced, apparently by order (with C++ this does not yet work). In addition, the language has improved the system for coordinating data visibility in module specifications and added tools to improve the efficiency of parallel tasks.

The US Department of Defense is quite jealous of its expensive brainchild and even registered the word “Ada” as its trademark. However, later, instead of the trademark, the Moscow Region decided to use “Ada” as its internal certified mark. The US Department of Defense is not particularly happy about the emergence of commercial versions of this language. Of course, no one has the right to prohibit you from writing your own compiler, but in order for it to receive commercial recognition, it must meet a military standard, and testing is carried out only by the AJPO committee of the US Department of Defense, which very strictly checks the compiler's compliance with many requirements, including, obviously, and purely political.

Nevertheless, various versions of Ada can be obtained, as is usually the case with programming languages, for free, that is, for nothing, but not in a pirated way, but simply freeware versions, and, of course, for money.

Of the freely distributed versions, it is first necessary to highlight the GNAT compiler - GNU Ada95. It is available in source code from the GNU (free software) project. It can also work on a computer with a single processor, but the operating system needs to support multitasking. This could be, for example, some version of UNIX or OS/2. As for MS DOS - guess for yourself. However, if you really want to run a hundred or two parallel processes on your personal computer under MS DOS 6.x, then you can try Ada/Ed - a compiler and interpreter for the 1987 version of the language, which, however, is completely incompatible with the standard and does not have a number of essential elements .

If you have money, then the situation, of course, becomes easier. Within the monthly salary of an average Russian programmer, you can purchase, for example, FirstAda and write a refrigerator control system. You can try to purchase more expensive systems for Windows, OS/2 or UNIX, certified by the US Department of Defense, directly from development companies, of which there are about a dozen.

It is interesting that not only the language itself was standardized, which made it possible to create easily portable programs, but also a set of developer aids - various input-output libraries and graphical interface organizations, preprocessors, verifiers, code generators, source code logical structure analyzers, testing programs compilers, etc. Of course, there are large packages that include all the standardized development tools, but they seem to be very expensive.

It would be very interesting to know whether the USSR was working on languages ​​designed to solve similar military problems. Or did our specialists write only in Assembly?

All programming languages ​​are divided into two groups:

1. with “static” (or “strong”) types;

2. with “dynamic” (or “weak”) types.

Both groups of languages ​​have their advantages and disadvantages. The main thesis of this article is: “Ada is the best statically typed language.”

Advantages of languages ​​with static types (and therefore automatically advantages of Ada, since Ada is a language with static types):

1. higher speed of program execution by many (often hundreds) times (by the way, the electricity consumption for useless heating of the processor is reduced by the same amount);

2. the possibility (fully implemented in Ada) of more reliable control of “stupid” errors, such as “confused” numbers and a string variable (sequence of characters).

Ada, in a sense, is the language with the "strongest" types among strongly typed languages. Hence the automatic conclusions:

1. Ada is one of the fastest programming languages ​​among all programming languages. The program can actually run a hundred times faster compared to dynamic programming languages.

2. Ada completely rejects “stupid” errors with mixed up data types. We will discuss this in more detail below.

Ada's story

The story of Ada's appearance deserves separate consideration.

The Pentagon (as the American Department of Defense is called because they are located in a building shaped like a Pentagon) announced a competition to create a programming language to solve military problems. The language had to provide high reliability of programs, enable the development of large complex systems, be high-speed and “readable” for programmers (even if the program text was written by another programmer), and also support the efficient use of multiprocessor systems (more recently widespread in the form multi-core processors - notice how the developers looked to the future!)

The competition was won by the language "Ada" (named after the 19th century female mathematician Ada Lovelace). By 1983, the so-called formal specification of Ada was written, which became known as Ada83.

Ada83 did not meet the requirements for a modern programming language. Therefore, on its basis, Ada95 (1995) was created, which can already be called a modern language, and later Ada2005 and Ada2012 (it is clear which years).

Ada has become widespread in areas requiring increased reliability (military industry, finance, infrastructure management, etc.), for example, the F-16 aircraft was made on Ada.

List of advantages of Ada

List of the main advantages of Ada:

1. Ada is one of the fastest programming languages. The program can actually run a hundred times faster.

2. Ada completely rejects “stupid” errors with mixed up data types.

3. Good control support even against less serious errors. (This gives four times fewer errors in Ada programs). We will dwell on this in more detail below.

4. Modular structure of the language. Support for large and complex programs.

5. Very good support for modern multi-core processors, as well as supercomputers with more than one processor.

6. A "powerful" modern programming language: object-oriented programming, templates, flexible memory allocation management, etc., etc. (Don't worry if you don't understand the terminology: this just means that Ada is a powerful modern language ).

7. Quite fast compilation (the programmer waits less for Ada to create the .exe file and has more free time for programming and finding errors).

8. Support all kinds of devices: computers, embedded electronics, spaceships, etc.

9. The language is such that it is convenient not only to write, but also to read (if you are a programmer).

10. There is a free but good development environment (programs for programmers).

11. There is an international standard.

12. Decimal fractions allow you to work, for example, with financial information.

Reliability or speed

There is a natural contradiction between the requirement of reliability and speed:

In order for the program to run at the highest possible speed, it is necessary to abandon checking the correctness of the program as it runs.

For example, there is a list of 10 numbers. If the program tries to change the 12th number in this list, it is nonsense. If the check was not carried out, this program will write our 12th number, in technical terminology, “everywhere” and the program may even corrupt itself and start doing something meaningless.

Therefore, to ensure reliability, the program must make checks against such meaningless actions. But checks require CPU time.

The resolution of this contradiction in Ada is as follows: There are two modes of operation: with checks and without checks (more precisely, there are more modes, because it is possible to selectively enable some types of checks, and leave some disabled). With checks, a program can work several times slower, but with checks it happens many times less often that the program starts doing complete nonsense.

Checks are often left turned on during initial debugging (searching for and correcting errors) of a program and turned off when the program is ready to increase speed and reduce the cost of electricity for heating the processor. If you commission me to program in Ada, we can agree whether to leave checks enabled after I hand over the finished program to you.

By the way, Ada is ready to check not only the most outstanding nonsense (such as the 12th element in a list of 10 numbers or division by zero), but also less serious errors. The unique system of “strong” types in Ada is able to automatically check, for example, that the month is always in the interval 1..12 (and not the 14th month, for example). These checks make the program much more reliable than programs in other programming languages. Recent versions of Ada moreover allow the programmer to do any kind of checks he wishes to do.

Myths about Hell

Myth 1: Ada is an “ancient” programming language

In fact, this myth is only true for the first version of Ada, Ada83, developed in 1983.

And the latest version of the Ada specification, Ada2012, is a completely recent and modern programming language with such modern features as object-oriented programming and template types.

I would say that Ada is even a "more modern" language than other modern programming languages.

Myth 2: Ada is only for large systems

Yes, Ada was designed primarily for large systems, such as the Pentagon's complex defense projects.

But these “big” capabilities are also useful for less complex systems. They make programming in general easier and more reliable, even for smaller programs. They reduce debugging time (finding errors) and thus reduce overall development time. This means I get the same work done in less time.

Myth 3: Ada is for electronics

Indeed, Ada is a good programming language for "embedded" systems (electronics), but it is just as good for regular personal computers. It's simply universal.

Myth 4: Ada requires expensive technology

In fact, there is a free Ada compiler (GNAT) for most modern operating systems. It comes with all the software for a professional programmer.

I work primarily with Linux. And of course, there is GNAT for Linux.

Disadvantages of Ada

Perhaps it would be unfair to talk only about the advantages and not mention the disadvantages.

Ada has the following disadvantages:

1. Ada is a powerful professional tool, and therefore, to use it skillfully, you need a highly qualified specialist (like me!)

2. Unfortunately, Ada did not become a highly popular language. As a result, “components” (ready-made program fragments) for many tasks are missing. For example, there are no really good components for developing Web sites in Ada.

3. A program in Ada may be slightly longer than in other programming languages; therefore, what fits on one page of text, say in Python (by the way, I also do programming in Python), may not fit on one page in Ada.

4. There are some other disadvantages (which I will not talk about in detail, since such a conversation requires special terminology), but they may seem like advantages against the background of the disadvantages of other programming languages.

The language of Hell has more or less always been around. At school we laughed at its name, in the university curriculum it was dryly mentioned as a language developed at the request of the US Department of Defense, but only rare programmers actually got to study the syntax or application. This led to the erroneous opinion that the Ada language functions only on centuries-old equipment, and the need for it will disappear along with natural modernization.

And this is very far from the truth.

Appearance

In the 70s of the 20th century, at the height of the Cold War, the US Department of Defense organized an international competition, based on the results of which it was necessary to choose a programming language for use for military purposes. However, none of the existing languages ​​satisfied the commission members, so through a long selection and several modifications, the Ada language was born, named after Ada Lovelace. Then began many years of red tape with standardization, trademark registration, bans on custom translators and other actions that discouraged the mass audience from working with Ada.

The result was a fairly niche language intended for complex computing systems with increased security requirements. Again, due to Pentagon requirements and strict standards, interaction with other programming languages ​​is extremely difficult, so until recently Ada had virtually no chance of moving to the mass market. But as equipment becomes cheaper and the technologies used become more complex, such a chance appears.

Syntax

Initially, Ada is a modular programming language with strong typing, inheriting the syntax from Pascal and Algol. If you learned the first one at school or college, then looking at “Hello, World!” should feel nostalgic:

with Ada.Text_IO;

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

One of the main requirements for the language was the reliability of its use. Accordingly, this entailed strict restrictions on structure, types, spelling and much more. In addition, almost all errors here are caught at the compilation stage.

Another requirement was maximum readability of the code in printed form, which resulted in the heaviness of the resulting language and low flexibility.

Later standards partially solved these problems, but for obvious reasons, they did not make a second Python out of Hell.

Ada today

Contrary to the opinion of a wide audience, the language of Hell is still actively used, not only in the United States and not only in the military industry. For example, part of the software of the Beriev Be-200 amphibious aircraft is written in Ada. Driverless subway trains that operate in many major cities (Paris, London, New York, etc.) also use US military language equipment.

And yes, of course, among the “clients” were military and civil aviation (in particular, the Boeing 777), rockets, shuttles, satellites - in general, almost the entire list of endlessly expensive American products that require the highest degree of safety.

Prospects

The Language of Hell was criticized both at the time of its appearance and when it became clear that the Pentagon’s grandiose plans do not quite fit in with reality, and even more so now. The reason for this is the inconvenient language, the complexity of the standards written in 1983 and 1995, as well as the shortsightedness of the developers who deprived the Ada language of a mass audience.

However, almost 40 years of active use confirm that the Ada language has perhaps coped with its main task - with its help it is still possible to create reliable code for systems with increased security requirements. At the same time, if you look at current trends, the number of such products is steadily growing: cars with autopilot and hybrid engines, private spacecraft and small aircraft, high-speed trains, as well as a huge number of embedded systems. All this is a potential field for the activity of the language of Hell. Add to this the fact that the standard was seriously revised and modernized in 2012, tools for the job are also being released and updated.

Thus, the language of Hell is both a fragment from a not very pleasant past, and one of the tools for building a bright future. And he's definitely not planning on retiring.

Features of the language

"Hello, world!" on Ada

Several different versions of the “Hello, world!” program can be seen in Wikibooks (English). The differences are due to the need to use the Put_Line library function - this language has three different ways of organizing this use.

with Ada.Text_IO;

procedure Hello is

Use Ada.Text_IO;

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.

Story

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 unified for the development of projects commissioned by the military department, mainly for the development of embedded systems for military purposes and for large military computers (based on iAPX 432 processor from Intel). Work began in 1975, with the formation of a set of language requirements that would fully satisfy developers of systems of this type. The initial list of requirements, codenamed "Straw", was submitted for review to a number of organizations and firms, and was gradually refined over the course of two years, ultimately becoming the final document called "Steel".

After completing the requirements, an analysis was carried out which showed that none of the existing programming languages ​​sufficiently satisfied the requirements, so the decision was made to develop a new language. A competition for its creation was announced in 1977; developers were asked to base it on one of three languages: Pascal, Algol-68 or PL/1.

Of the 15 projects submitted to the competition, 4 were selected (all based on Pascal). These projects were sent for further development. At the next stage, out of 4 projects, two were selected, of which, after further refinement, one was selected. This language was named “Ada” - the group that developed it, led by the Frenchman Jean Ishbia, gave the language a name in honor of Augusta Ada King Lovelace (daughter of the poet J. Byron), who is considered the first programmer in the world for developing programs for Babbage’s computer.

Dijkstra, in one of his articles, doubted that a language of such complexity as Ada could be observable and manageable. He noted: “If Ada is going to issue a standard, it wants it to be unambiguously documented. At least two groups have attempted this; as a result, both produced about 600 pages of formal text. This is much more than is necessary to make sure that it is impossible to even firmly establish that both documents define the same language. The fault with the apparent uncontrollability of these two documents lies neither in the two groups that composed them, nor in the formalism they adopted, but only in the language itself: without themselves providing a formal definition of whether its developers can hide the fact 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.”

Hoar lamented that "the bells and whistles have taken precedence over the fundamental requirements of reliability and safety" and warned against "an armada of missiles going the wrong way because of an undetected bug in the Ada compiler." Niklaus Wirth spoke more restrainedly, but also negatively. He said: “Too much is thrown at the programmer. I don’t think that after studying a third of Ada, you can work normally. If you don’t master all the details of the language, you may stumble over them in the future, and this will lead to unpleasant consequences.” Jean Ishbia, Ada's development team leader, while expressing his "respect and admiration" for Wirt, disagreed, 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 compliance of the compiler with the language standard through testing also raises doubts. As a general matter, it is clear that testing can find inconsistencies, but cannot guarantee correctness. Practical confirmation of this is the fact that certified compilers, when tested on a different set of tests, found non-compliance with the standard.

Proponents of Ada argue that the only alternative to a large and complex language in large projects is the use of several compact languages, which inevitably gives rise to the compatibility problems that Ada was invented to get rid of. They also note that the idea of ​​​​the complexity of development in Ada is only partly 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 greatly simplified. According to Stephen Zeiger from Rational Software Corporation, software development in Ada is generally 60% cheaper, and the developed program has 9 times fewer defects than when using the C language.

Distribution, prospects

In practice, it turned out that Ada, having occupied its intended niche in military and related developments of embedded systems, never went 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 focus on its complexity and shortcomings; supporters speak, first of all, about the objective circumstances of the appearance of the language and the negative aspects of the process of its implementation. The opinion of S.I. Rybin, senior researcher at the Research Computing Center of Moscow State University, consultant to AdaCore EU, expert on the Ada language of the ISO working group on the language standard, is interesting. He believes that Ada owes its 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 was 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,” they preferred other languages ​​that were more adapted to a multilingual environment. The 1995 standard solved the problem of interoperability with other languages, but time was lost.
  • Paradoxically, the spread of Ada was prevented by the financial and organizational support of the Pentagon. Ada programs written for the military ran on the most powerful computing hardware available, so compiler developers were concerned primarily with passing the ACVC tests, and only then with the efficiency of the compiler and the code it produced. In the early 1980s, a boom in microcomputers 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, which a few years later became the bulk of the world's computing fleet, found themselves without a high-quality Ada translator. Naturally, Ada lost this market segment. Only relatively recently did the GNAT compiler appear, high-quality and productive, but here too time was lost.

Currently, Ada is quite firmly established in the development of large embedded systems of increased reliability; here it has practically no strong competitors. The use of the language is gradually increasing, although rather slowly. According to some cautious forecasts, with cheaper hardware and the spread of embedded systems with complex software, the market for Ada programs may grow significantly, and the use of the language will also grow.

In addition, Ada has, albeit very limited, application in 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: in the industry they practically do not know about Ada, accordingly, from the industry there is no request for education to train Ada specialists, and new people come from universities to the industry, who know practically nothing about Ada.

Operating systems written in Ada

Embedded Systems

  • RTEMS is an open source OS developed by DARPA of the US Department of Defense
  • Ravenskar
  • RTOS-32 - proprietary OS

Systems in development

  • AuroraUX (a project to rewrite the OpenSolaris kernel into Ada)
  • Lovelace (kernel operating system)

No longer existing systems

  • BiiN™
  • Pulse™
  • AdaOS

Compilers of Hell

NameCompanyVersionoperating systemWebsite
AdaMagicSofCheckAda 95 ? www.sofcheck.com
AdaMULTIGreen Hills SoftwareAda 83, Ada 95,






2024 gtavrl.ru.