Ada Programming Introduction and Resources

Originally developed for the Department of Defense, the Ada programming language was designed for critical systems where security and reliability are essential. Ada is a structured, object-oriented, high-level programming language, with built-in support for concurrency, synchronous message passing, protected objects, and contract programming. In additional to continued military use, Ada is widely used for operation-critical projects, such as air traffic control, satellites, commercial aircraft, medical equipment, public transportation systems — including several metro systems and the TGV high speed rail — and the banking industry.

Because it was designed specifically for environments that rely on a high level of security and need to be operational at all times, Ada code is both more secure and inflexible than many other programming languages. It is a strongly typed language, meaning its compiler is much more rigid about the arguments being passed to functions, and more likely to report an error. It also uses a compiler to identify errors, rather than runtime errors, for a higher degree of code safety.

Ada is an ALGOL-like programming language, meaning it incorporates many of the concepts of Algorithmic Language, such as the inclusion of reserved words for logic statements, including if, then, while, else, true, false, etc. Ada also includes a number of non-ALGOL features, such as type definitions, pointers, and enumerations.

Some other notable features of Ada include:

  • Modular programming, allowing for separate parts of the program to run as independent modules, improving code maintenance and reliability.
  • Exceptions handling, allowing Ada programs to address their own run-time errors.
  • Scalar ranges, allowing programmers to explicitly set a range of acceptable values for variables.
  • Systems programming, which lets programmers manipulate computers at the hardware level, including the ability to specify bit layout for record fields and allocate a specific address for data placement.
  • The ability to limit language features at compile in order to meet safety standards and certification requirements.
  • An emphasis on readability and limitations on ambiguous coding, which makes it an easy language to review, troubleshoot, and reuse.
  • Strict language definitions and standardization make Ada highly portable, because compilers must adhere to these definitions with only a few exceptions. This makes it easy to port Ada code from one compiler to another and even from one platform to another.

Sample Program

This simple program asks for user input and uses it to compute the user's age in months. It is written for the free GNAT compiler. It uses the GNAT IO library. The program demonstrates many basic features of the Ada syntax.

with Gnat.Io; use Gnat.Io;
procedure Month_Age is
   Years: Integer;
   Months: Integer;

begin
   Put ("Enter your age in years: ");
   Get (Years);
   Months := 12*Years;

   Put ("You are ");
   Put (Months);
   Put (" months old.");
end Month_Age;

After loading the IO library, the program creates a new procedure, Month_Age, and then assigns two variables. The actual procedure is contained within the "begin" and "end" commands. The "Put" command outputs text to the screen. The "Get" command collects user input, and in the case above assigns it to the variable, Years. Once assigned, the Years value is multiplied by 12 to establish a value for Months. The last three lines of the procedure outputs text to the user, along with the new value of Months (their age in months).

History

Ada was designed by Jean Ichbiah during the late 1970s, in response to a request for proposal by the US Department of Defense. The DoD was attempting to consolidate the large number of programming languages (over 450) used in their embedded computer projects, many of which had become obsolete or were dependent on outdated hardware. It formed the High Order Language Working Group, a collection of industry experts, to review current languages and determine the best one to address the DoD's needs; but the group ultimately determined no existing language met their requirements.

After receiving several proposals, the group selected the one submitted by CII Honeywell Bull, led by Ichbiah. Their proposed language, Ada, was heavily influenced by another programming language the team developed earlier that decade, LIS.

Despite initial claims that Ada would quickly be adopted by the general programming community and could very well become the world's most dominate programming language, early implementation proved too sluggish for a mass audience. Critics called Ada overly complex (it was, after all, trying to fill the role of hundreds of embedded languages) and unreliable.

Despite these setbacks, Ada persevered, and throughout the 1980s and early 1990s, Ada code was implemented into a number of systems, and in 1991 the DoD mandated that all Ada be used for all of its software—a requirement that was removed in 1997.

While Ada probably isn't the first language most hobbyist decide to try their hands at, it has established itself as a critical tool for industries that require stable, reliable code, largely due to Ada's inherent safety and security features.

Ada Lovelace

The Ada programming language was named for Augusta Ada King, Countess of Lovelace, better known as Ada Lovelace.

Born in 1815, the daughter of Lord George Byron and Anne Isabella Milbanke, Ada excelled at Mathemetics, and during her teenage years formed a friendship with the mathematician Charles Babbage. While assisting Babbage with his work on his Analytical Engine, Ada created a series of notes that contained what many consider to be the original computer algorithm.

Ada Compilers

There are a number of Ada compilers available:

Online Resources

Ada has developed a strong community of users, particularly those interested in security, and there is no shortage of advice, groups, and online tutorials to help you get started or further your Ada knowledge. Here are some of our favorites:

  • Ada Information Clearinghouse: if programming languages could have their own fan sites, this would be Ada's. It's the place to find recent news, information about current standards, online tutorials, and even a very thorough rundown on why Ada is so much better than everything else out there.
  • AdaCore University: this is a complete training program to the Ada language. The site features dozens of video-based e-learning modules, covering Ada basics, major features, interaction with other programming languages, and concurrency.
  • Ada Programming by Wikibooks: this free reference provides background on Ada, general knowledge of the language features, foundational skills, and project-based tutorials. Each chapter includes tutorials on major concepts and sample code.
  • Ada2012: Ada saw some big improvements in 2012, and this site captures them all, including a side-by-side comparison of past versions. It also features reference manuals, tutorials, and recent Ada news.
  • The GNAT Academic Program: if you're considering a degree in computer science and want to focus on Ada, this site provides a list of all the Universities that feature Ada as part of their curriculum.

Books

The library of Ada books is not as rich as for some other programming languages, and the majority of titles assume a certain level of previous programming knowledge. What's more, many of the best books available today were written before Ada2012. They're still great resources and provide and excellent guide to the language, but you should be aware that there have been some changes, so you'll need to brush up on those at some point (check out our resource section above when you're ready).

  • Programming in Ada2012 by John Barnes: though an introduction to Ada, this is an advanced text that assumes the reader already has significant programming knowledge. It takes the approach that Ada is not simply another programming language, but a tool for sophisticated software engineering.
  • Building Parallel, Embedded, and Real-Time Applications with Ada by McCormick, Singhoff, and Hugues: designed for undergraduate students and programmers with existing knowledge of sequential programming, this text aims to broaden the reader's knowledge to include advanced concepts of parallel and distributed computing. It places a heavy emphasis on theory, so if you're looking for a hands-on tutorial, this probably isn't for you, but if you want to expand your overall understanding, this is a must-read.
  • Programming and Problem Solving with Ada 95 by Dale, Weems, and McCormick: though not a recent text, we've included this one on our list because it is one of the few Ada books designed for new programmers. With a heavy emphasis on teaching good programming habits, the book walks students through major programming concepts with real-world problem solving, regular testing, warm up exercises, and regularly-placed quick checks.
  • Ada for Software Engineers by Mordechai Ben-Ari: as the name suggests, this is another resource for experienced programmers. This book has been criticized for being too complex for some readers. But, to be fair, Ada is designed for complex software development, so if you can't handle this book, Ada might not be the best language for you. The author focuses on essential concepts of the Ada language, using several case studies to demonstrate their applications. It also includes comparisons to other languages, including C and Java, to ease the transition.

Summary

Ada is not most people's first programming language, and it will probably never be used for fun, quick programming like web applications or mobile apps. However, for serious programmers who want to focus on highly-secure, mission-critical applications, Ada should be at the top of your list for programs to learn next, particularly if you're interested in public transportation, avionics, finance, or contributing to the next big thing in space exploration.