Ada (programming language)

From Seo Wiki - Search Engine Optimization and Programming Languages
Jump to navigationJump to search
Ada
Paradigm Multi-paradigm
Appeared in 1983
Designed by Jean Ichbiah, extended by S. Tucker Taft
Stable release Ada 2005 (2005)
Typing discipline static, strong, safe, nominative
Major implementations GNAT
Dialects Ada 83, Ada 95, Ada 2005
Influenced by ALGOL 68, Pascal, C++ (Ada 95), Smalltalk (Ada 95), Java (Ada 2005)
Influenced C++, Eiffel, PL/SQL, VHDL, Ruby

Ada is a structured, statically typed, imperative, wide-spectrum, and object-oriented high-level computer programming language, extended from Pascal and other languages. It was originally designed by a team led by Jean Ichbiah of CII Honeywell Bull under contract to the United States Department of Defense (DoD) from 1977 to 1983 to supersede the hundreds of programming languages then used by the DoD. Ada is strongly typed and compilers are validated for reliability in mission-critical applications, such as avionics software. Ada is an international standard; the current version (known as Ada 2005) is defined by joint ISO/ANSI standard (ISO-8652:1995), combined with major Amendment ISO/IEC 8652:1995/Amd 1:2007.

Ada was named after Ada Lovelace (1815–1852), who is often credited as being the first computer programmer.[1]

Features

Ada was originally targeted at embedded and real-time systems. The Ada 95 revision, designed by S. Tucker Taft of Intermetrics between 1992 and 1995, improved support for systems, numerical, financial, and object-oriented programming (OOP).

Notable features of Ada include: strong typing, modularity mechanisms (packages), run-time checking, parallel processing (tasks), exception handling, and generics. Ada 95 added support for object-oriented programming, including dynamic dispatch.

Ada supports run-time checks to protect against access to unallocated memory, buffer overflow errors, off-by-one errors, array access errors, and other detectable bugs. These checks can be disabled in the interest of runtime efficiency, but can often be compiled efficiently. It also includes facilities to help program verification. For these reasons, Ada is widely used in critical systems, where any anomaly might lead to very serious consequences, i.e., accidental death or injury. Examples of systems where Ada is used include avionics, weapon systems (including thermonuclear weapons), and spacecraft.

Ada also supports a large number of compile-time checks to help avoid bugs that would not be detectable until run-time in some other languages or would require explicit checks to be added to the source code. Ada is designed to detect small problems in very large software systems. For example, Ada detects each misspelled variable (due to the rule to declare each variable name), and Ada pinpoints unclosed if-statements, which require "END IF" rather than mismatching with any "END" token. Also, Ada can spot procedure calls with incorrect parameters, which is a common problem in large, complex software where most of the statements are procedure calls.

Ada's dynamic memory management is high-level and type-explicit, requiring explicit instantiation of the Unchecked_Deallocation package to explicitly free allocated memory. The specification does not require any particular implementation. Though the semantics of the language allow automatic garbage collection of inaccessible objects, most implementations do not support it. Ada does support a limited form of region-based storage management. Invalid accesses can always be detected at run time (unless of course the check is turned off) and sometimes at compile time.

The syntax of Ada is simple, consistent and readable. It minimizes choices of ways to perform basic operations, and prefers English keywords (eg "or else") to symbols (e.g. "||"). Ada uses the basic mathematical symbols (i.e.: "+", "-", "*" and "/") for basic mathematical operations but avoids using other symbols. Code blocks are delimited by words such as "declare", "begin" and "end". Conditional statements are closed with "end if", avoiding a dangling else that could pair with the wrong nested if-expression in other languages.

Ada was designed to use the English language standard for comments: the em-dash, as a double-dash ("--") to denote comment text. Comments stop at end of line, so there is no danger of unclosed comments accidentally eating whole sections of source code. Comments can be nested: prefixing each line (or column) with "--" will skip all that code, while being clearly denoted as a column of repeated "--" down the page. There is no limit to the nesting of comments, thereby allowing prior code, with commented-out sections, to be commented-out as even larger sections. All Unicode characters are allowed in comments, such as for symbolic formulas (E[0]=m×c²). To the compiler, the double-dash is treated as end-of-line, allowing continued parsing of the language as a context-free grammar.

The semicolon (";") is a statement terminator, and the null or no-operation statement is null;. A single ; without a statement to terminate is not allowed. This allows for a better quality of error messages.

Code for complex systems is typically maintained for many years, by programmers other than the original author. It can be argued that these language design principles apply to most software projects, and most phases of software development, but when applied to complex, safety critical projects, benefits in correctness, reliability, and maintainability take precedence over (arguable) costs in initial development.

Unlike most ISO standards, the Ada language definition (known as the Ada Reference Manual or ARM, or sometimes the Language Reference Manual or LRM) is free content. Thus, it is a common reference for Ada programmers and not just programmers implementing Ada compilers. Apart from the reference manual, there is also an extensive rationale document which explains the language design and the use of various language constructs. This document is also widely used by programmers. When the language was revised, a new rationale document was written.

One notable Free Software tool that is used by many Ada programmers to aid them in writing Ada source code is GPS, the GNAT Programming Studio.

History

In the 1970s, the US Department of Defense (DoD) was concerned by the number of different programming languages being used for its embedded computer system projects, many of which were obsolete or hardware-dependent, and none of which supported safe modular programming. In 1975, the High Order Language Working Group (HOLWG) was formed with the intent to reduce this number by finding or creating a programming language generally suitable for the department's requirements. The result was Ada. The total number of high-level programming languages in use for such projects fell from over 450 in 1983 to 37 by 1996.

Template:Wikisource The working group created a series of language requirements documents—the Strawman, Woodenman, Tinman, Ironman and Steelman documents. Many existing languages were formally reviewed, but the team concluded in 1977 that no existing language met the specifications.

Requests for proposals for a new programming language were issued and four contractors were hired to develop their proposals under the names of Red (Intermetrics led by Benjamin Brosgol), Green (CII Honeywell Bull, led by Jean Ichbiah), Blue (SofTech, led by John Goodenough), and Yellow (SRI International, led by Jay Spitzen). In April 1978, after public scrutiny, the Red and Green proposals passed to the next phase. In May 1979, the Green proposal, designed by Jean Ichbiah at CII Honeywell Bull, was chosen and given the name Ada—after Augusta Ada, Countess of Lovelace. This proposal was influenced by the programming language LIS that Ichbiah and his group had developed in the 1970s. The preliminary Ada reference manual was published in ACM SIGPLAN Notices in June 1979. The Military Standard reference manual was approved on December 10, 1980 (Ada Lovelace's birthday), and given the number MIL-STD-1815 in honor of Ada Lovelace's birth year. In 1981, C. A. R. Hoare took advantage of his Turing Award speech to criticize Ada for being overly complex and hence unreliable,[2] but subsequently seemed to recant in the foreword he wrote for an Ada textbook.[3]

Ada attracted much attention from the programming community as a whole during its early days. Its backers and others predicted that it might become a dominant language for general purpose programming and not just defense-related work. Ichbiah publicly stated that within ten years, only two programming languages would remain, Ada and Lisp.[4] Early Ada compilers struggled to implement the large, complex language, and both compile-time and run-time performance tended to be slow and tools primitive. Compiler vendors expended most of their efforts in passing the massive, language-conformance-testing, government-required "ACVC" validation suite that was required in another novel feature of the Ada language effort.[4]

File:Ada Lovelace 1838.jpg
Augusta Ada King, Countess of Lovelace.

In 1987, the US Department of Defense began to require the use of Ada (the Ada mandate) for every software project where new code was more than 30% of result, though exceptions to this rule were often granted.

By the late 1980s and early 1990s, Ada compilers had improved in performance, but there were still barriers to full exploitation of Ada's abilities, including a tasking model that was different from what most real-time programmers were used to.[4]

The Department of Defense Ada mandate was effectively removed in 1997, as the DoD began to embrace COTS (commercial off-the-shelf) technology. Similar requirements existed in other NATO countries.

Because Ada is a strongly typed language and has other safety-critical support features, it has found a niche outside the military in commercial aviation projects, where a software bug can cause fatalities. The fly-by-wire system software in the Boeing 777 was written in Ada. The Canadian Automated Air Traffic System was written in 1 million lines of Ada (SLOC count). It featured advanced (for the time) distributed processing, a distributed Ada database, and object-oriented design.

Standardization

The language became an ANSI standard in 1983 (ANSI/MIL-STD 1815A), and without any further changes became an ISO standard in 1987 (ISO-8652:1987). This version of the language is commonly known as Ada 83, from the date of its adoption by ANSI, but is sometimes referred to also as Ada 87, from the date of its adoption by ISO.

Ada 95, the joint ISO/ANSI standard (ISO-8652:1995) is the latest standard for Ada. It was published in February 1995, making Ada 95 the first ISO standard object-oriented programming language. To help with the standard revision and future acceptance, the US Air Force funded the development of the GNAT Compiler. Presently, the GNAT Compiler is part of the GNU Compiler Collection.

Work has continued on improving and updating the technical content of the Ada programming language. A Technical Corrigendum to Ada 95 was published in October 2001, and a major Amendment, ISO/IEC 8652:1995/Amd 1:2007, was published on March 9, 2007. Other related standards include ISO 8651-3:1988 Information processing systems—Computer graphics—Graphical Kernel System (GKS) language bindings—Part 3: Ada

Language constructs

Ada is a Algol-like programming language featuring control structures with reserved words such as if, then, else, while, for, and so on. However, Ada also has many data structuring facilities and other abstractions which were not included in the original Algol60, like type definitions, records, pointers, enumerations. Such constructs were in part inherited or inspired from Pascal.

"Hello, world!" in Ada

A common example of a language's syntax is the Hello world program:

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

Ada also provides alternative constructions that are more streamlined.

Data types

Ada's type system is not based around a set of predefined primitive types but allows users to declare their own types. This declaration in turn is not based on the internal representation of the type but on describing the goal which should be achieved.

For example a date might be represented as:

type Day   is range    1 ..   31;
type Month is range    1 ..   12;
type Year  is range 1800 .. 2100;

type Date is
   record
     Day   : Day;
     Month : Month;
     Year  : Year;
   end record;

Control structures

Ada is a structured programming language, meaning that the flow of control is structured into standard statements. All standard constructs and deep level early exit are supported so the use of the also supported 'go to' commands is seldom needed.

while a /= b loop
  Ada.Text_IO.Put_Line ("Waiting");
end loop;

if a > b then
  Ada.Text_IO.Put_Line ("Condition met");
else
  Ada.Text_IO.Put_Line ("Condition not met");
end if;

for i in 1 .. 10 loop
  Ada.Text_IO.Put ("Iteration: ");
  Ada.Text_IO.Put (i);
  Ada.Text_IO.Put_Line;
end loop;

loop
  a := a + 1
  exit when a = 10;
end loop;

case i is
  when 0 => Ada.Text_IO.Put("zero");
  when 1 => Ada.Text_IO.Put("one");
  when 2 => Ada.Text_IO.Put("two");
end case;

Packages, procedures and functions

Ada programs consist of packages, procedures and functions.

with Ada.Text_IO; 

package Mine is

  type Integer is range 1 .. 11;

  i : Integer := Integer'First;
   
  procedure Print (j: in out Integer) is
  
    function Next (k: in Integer) return Integer is
    begin
      return k + 1;
    end Next;
  
  begin
    Ada.Text_IO.Put_Line ('The total is: ', j);
    j := Next (j);
  end Print;
  
begin
  while i < Integer'Last loop
    Print (i);
  end loop;
end Mine;

Packages, Procedures and functions can nest to any depth and each can also be the logical outermost block.

Each package, procedure or function can have its own declarations of goto labels, constants, types, variables, and other procedures, functions and packages, which can be declared in any order.

See also

Notes

  1. J. Fuegi and J. Francis, "Lovelace & Babbage and the creation of the 1843 'notes'." Annals of the History of Computing 25 #4 (October-December 2003): 16-26. Digital Object Identifier
  2. C.A.R. Hoare, "The Emperor's Old Clothes." Communications of the ACM, 1981.
  3. D.A. Watt, B.A. Wichmann and W. Findlay, "Ada: Language and Methodology." Prentice-Hall, 1987.
  4. 4.0 4.1 4.2 J-P. Rosen, "The Ada Paradox(es)", Ada Letters, ACM SIGAda, Vol. 24, No. 2, August 2009, pp. 28-35.

References

International Standards

Rationale

(These documents have been published in various forms including print.)

Books

  • Grady Booch: SOFTWARE ENGINEERING WITH Ada, California: The Benjamin/Cummings Publishing Company, Inc., 1987. ISBN 0-8053-0604-8
  • Jan Skansholm: Ada 95 From the Beginning, Addison-Wesley, ISBN 0-201-40376-5
  • Geoff Gilpin: Ada: A Guided Tour and Tutorial, Prentice hall, ISBN 978-0-13-004045-9
  • John Barnes: Programming in Ada 2005, Addison-Wesley, ISBN 0-321-34078-7
  • John Barnes: Programming in Ada plus Language Reference Manual, Addison-Wesley, ISBN 0-201-56539-0
  • John Barnes: Programming in Ada 95, Addison-Wesley, ISBN 0-201-34293-6
  • John Barnes: High Integrity Ada: The SPARK Approach, Addison-Wesley, ISBN 0-201-17517-7
  • John Barnes: High Integrity Software: The SPARK Approach to Safety and Security, Addison-Wesley, ISBN 0-321-13616-0
  • John Beidler: Data Structures and Algorithms: An Object-Oriented Approach Using Ada 95, Springer-Verlag, ISBN 0-387-94834-1
  • Dean W. Gonzalez: Ada Programmer's Handbook, Benjamin-Cummings Publishing Company, ISBN 0-8053-2529-8
  • M. Ben-Ari: Ada for Software Engineers, John Wiley & Sons, ISBN 0-471-97912-0
  • Norman Cohen: Ada as a Second Language, McGraw-Hill Science/Engineering/Math, ISBN 0-07-011607-5
  • Alan Burns, Andy Wellings: Real-Time Systems and Programming Languages. Ada 95, Real-Time Java and Real-Time POSIX., Addison-Wesley, ISBN 0-201-72988-1
  • Alan Burns, Andy Wellings: Concurrency in Ada, Cambridge University Press, ISBN 0-521-62911-X
  • Colin Atkinson: Object-Oriented Reuse, Concurrency and Distribution: An Ada-Based Approach, Addison-Wesley, ISBN 0-201-56527-7
  • Grady Booch, Doug Bryan: Software Engineering with Ada, Addison-Wesley, ISBN 0-8053-0608-0
  • Daniel Stubbs, Neil W. Webre: Data Structures with Abstract Data Types and Ada, Brooks Cole, ISBN 0-534-14448-9
  • Pascal Ledru: Distributed Programming in Ada with Protected Objects, Dissertation.com, ISBN 1-58112-034-6
  • Fintan Culwin: Ada, a Developmental Approach, Prentice Hall, ISBN 0-13-264680-3
  • John English, Fintan Culwin: Ada 95 the Craft of Object Oriented Programming, Prentice Hall, ISBN 0-13-230350-7
  • David A. Wheeler: Ada 95, Springer-Verlag, ISBN 0-387-94801-5
  • David R. Musser, Alexander Stepanov: The Ada Generic Library: Linear List Processing Packages, Springer-Verlag, ISBN 0-387-97133-5
  • Michael B. Feldman: Software Construction and Data Structures with Ada 95, Addison-Wesley, ISBN 0-201-88795-9
  • Simon Johnston: Ada 95 for C and C++ Programmers, Addison-Wesley, ISBN 0-201-40363-3
  • Michael B. Feldman, Elliot B. Koffman: Ada 95, Addison-Wesley, ISBN 0-201-36123-X
  • Nell Dale, Chip Weems, John McCormick: Programming and Problem Solving with Ada 95, Jones & Bartlett Publishers, ISBN 0-7637-0293-5
  • Nell Dale, John McCormick: Ada Plus Data Structures: An Object-Oriented Approach, 2nd edition, Jones & Bartlett Publishers, ISBN 0-7637-3794-1
  • Bruce C. Krell: Developing With Ada: Life-Cycle Methods, Bantam Dell Pub Group, ISBN 0-553-09102-6
  • Judy Bishop: Distributed Ada: Developments and Experiences, Cambridge University Press, ISBN 0-521-39251-9
  • Bo Sanden: Software Systems Construction With Examples in Ada, Prentice Hall, ISBN 0-13-030834-X
  • Bruce Hillam: Introduction to Abstract Data Types Using Ada, Prentice Hall, ISBN 0-13-045949-6
  • David Rudd: Introduction to Software Design and Development With Ada, Brooks Cole, ISBN 0-314-02829-3
  • Ian C. Pyle: Developing Safety Systems: A Guide Using Ada, Prentice Hall, ISBN 0-13-204298-3
  • Louis Baker: Artificial Intelligence With Ada, McGraw-Hill, ISBN 0-07-003350-1
  • Alan Burns, Andy Wellings: HRT-HOOD: A Structured Design Method for Hard Real-Time Ada Systems, North-Holland, ISBN 0-444-82164-3
  • Walter Savitch, Charles Peterson: Ada: An Introduction to the Art and Science of Programming, Benjamin-Cummings Publishing Company, ISBN 0-8053-7070-6
  • Mark Allen Weiss: Data Structures and Algorithm Analysis in Ada, Benjamin-Cummings Publishing Company, ISBN 0-8053-9055-3
  • Henry Ledgard: ADA: AN INTRODUCTION (Second Edition), Springer-Verlag, ISBN 0-387-90814-5
  • Dines Bjørner; Ole N. Oest (eds.): Towards a Formal Description of Ada, London: Springer-Verlag, 1980. ISBN 3-540-10283-3

Archives

External links

ar:أيدا (لغة برمجة) an:Luengache de programazión Ada az:Ada dili bn:অ্যাডা bg:Ada ca:Ada cv:Ада cs:Ada da:Ada (programmeringssprog) de:Ada (Programmiersprache) el:Ada es:Ada (lenguaje de programación) eo:Ada (programlingvo) eu:Ada (programazio lengoaia) fa:ایدا fr:Ada (langage) gl:Ada ko:에이다 hr:Ada (programski jezik) id:Ada (bahasa pemrograman) it:Ada (linguaggio) he:עדה (שפת תכנות) hu:Ada (programozási nyelv) nl:Ada (programmeertaal) ja:Ada no:Ada nn:Programmeringsspråket Ada pl:Ada (informatyka) pt:Ada (linguagem de programação) ru:Ада (язык программирования) sk:Ada (programovací jazyk) sl:Ada (programski jezik) sr:Ада (програмски језик) fi:Ada (ohjelmointikieli) sv:Ada (programspråk) th:ภาษาเอดา tg:Ада (забони барноманависӣ) tr:Ada (programlama dili) uk:Ada vi:Ada (ngôn ngữ lập trình) zh:Ada