Skip to content
Tutorials Center
My learning

Topics

Lesson 1 of 36 ยท Getting Started

What Is Ada? History, Goals and Where It Is Used

Meet Ada, the language built for software that must not fail: its history, design goals, how it differs from C, where it flies and rides, and how this course works.

Ada is a compiled, statically typed programming language designed for software where a bug can cost lives or millions of dollars: airplane controllers, railway signaling, satellites, medical devices and defense systems. Its design goal is simple to state and hard to achieve: let the compiler and runtime catch as many mistakes as possible, and make the program easy to read years later.

This course teaches modern Ada (Ada 2022) from the first program to concurrency, contracts and the SPARK proof subset. In this first lesson you will learn where Ada came from, what makes it different, and how the examples in this course work.

Honest note about the runner. This site cannot compile or run Ada code, because no Ada compiler (GNAT) is installed on the code runner. Ada listings are therefore read-only, and I show their output only when it is certain from the language rules. Next to them you get runnable C stand-ins, clearly labelled, that let you experiment with the underlying idea (a range check, a state machine, a bit mask). Install GNAT locally to run the real thing; the toolchain lesson shows how.

A short history

In the 1970s the United States Department of Defense counted hundreds of programming languages across its projects. Maintenance was costly and reliability poor. It ran a competition for one common language, and a design team led by Jean Ichbiah won. The language was named after Ada Lovelace, who wrote the first published algorithm for a machine in the 1840s.

Ada became a standard in 1983 and has been revised several times: Ada 95 added object orientation, Ada 2005 added interfaces and a richer library, Ada 2012 added contracts (preconditions and postconditions), and Ada 2022 added parallel blocks, more expressive syntax and further library improvements. Each revision is backward compatible in spirit: old code keeps working.

What makes Ada different

Ada's features serve four goals.

  • Readability over brevity. Ada uses words where C-family languages use punctuation: begin ... end, if ... then ... end if, and then, or else. You write code once and read it many times.
  • Strong typing. Two types are different even when both are integers. A Meters value cannot be added to a Seconds value by accident.
  • Checks built in. Array bounds, integer ranges and null dereferences are checked at run time (or proven safe at compile time with SPARK) instead of silently corrupting memory.
  • Concurrency in the language. Tasks and protected objects are part of Ada itself, not a library.

Here is a first taste. It is read-only on this site:

ADA
with Ada.Text_IO;

procedure Hello is
begin
   Ada.Text_IO.Put_Line ("Hello from Ada!");
end Hello;

The program Hello imports a package with with, defines a procedure, and prints a line. Everything has a name and a closing label, so the end of a block always says what it ends.

Ada versus C in one picture

C trusts you completely. Ada trusts you, then checks. The same mistake plays out differently:

Mistake C Ada
Write past the end of an array Undefined behavior Constraint_Error (or rejected at compile time)
Integer overflow on signed types Undefined behavior Constraint_Error
Mix meters and seconds Compiles Compile error
Forget a case in a switch Often silent Compile error for case statements

You can feel the difference with a C stand-in that does by hand what Ada does automatically: reject a value outside a declared range.

C Stand-in: a range check by hand

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with scanf or fgets), it gets the next line from this box.

In Ada you declare the range once on the type; the compiler inserts every check for you.

Where Ada is used

Ada is not a toy or a museum piece. It runs in aircraft flight software, air-traffic control, high-speed and metro railways, satellite launchers, space probes, automotive and industrial controllers, and financial infrastructure. Standards such as DO-178C (airborne software) and EN 50128 (railways) are comfortable with Ada, and SPARK, its provable subset, is used where even testing is not enough.

It is also taught for a different reason: learning Ada makes you a more careful programmer in every other language.

How this course is organized

flowchart LR
    A["1. Getting Started"] --> B["2. Types and Control Flow"]
    B --> C["3. Subprograms and Packages"]
    C --> D["4. Strong Typing and Generics"]
    D --> E["5. Tasking"]
    E --> F["6. Exceptions and Contracts"]
    F --> G["7. SPARK"]
    G --> H["8. Systems and Tools"]
    H --> I["9. Projects"]

Nine chapters take you from a first program to formal proof.

Each lesson shows Ada code read-only, explains it, and gives you a C stand-in to run. The stand-ins are deliberately small: a state machine, a bit mask, a bounded buffer. They are not Ada, and they are labelled as such, but they let you test your understanding of the concept.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Who or what is the language Ada named after?

    The language honors Ada Lovelace, often described as the first programmer.
  2. 2. Which statement best describes Ada's design philosophy?

    Ada favors readability and compile-time and run-time checking over brevity.
  3. 3. Why are the Ada listings on this site read-only?

    The runner supports other languages, so Ada appears as real read-only code plus labelled C stand-ins.
  4. 4. In Ada, what normally happens when a value falls outside its declared range?

    Range violations raise Constraint_Error at run time, and SPARK can prove they never happen.

Summary

  • Ada is a statically typed, compiled language built for high-integrity software.
  • It was commissioned by the US Department of Defense and standardized in 1983; Ada 2022 is the latest revision.
  • Strong typing, run-time checks, readable syntax and built-in concurrency are its trademarks.
  • It is used in avionics, railways, space and other safety-critical domains.
  • On this site, Ada code is read-only and paired with labelled C stand-ins.

Next: Hello World and Program Structure