Ada Programming/All Chapters

From Wikibooks, the open-content textbooks collection

Jump to: navigation, search

Augusta Ada King, Countess of Lovelace.
Augusta Ada King, Countess of Lovelace.

Contents


Preface

This book is currently being worked on by the Wikipublish Wikiproject. It has been judged to be of high enough quality to be published and distributed. All authors of this book are welcome to help with the publishing effort.

Welcome to the Ada Programming tutorial at Wikibooks. This is the first Ada tutorial covering the Ada 2005 standard. If you are a beginner you will learn the latest standard - if you are a seasoned Ada user you can see what's new.

Current Development Stage for Ada Programming is "Development stage: 75% (as of Jul 27, 2005) (Jul 27, 2005)". At this date, there are more than 200 pages in this book, which makes Ada Programming the largest of the programming wikibooks[1].

But still there is always room for improvement — do help us to expand Ada Programming. Even beginners will find areas to participate.

About Ada


Ada is a programming language named after Augusta Ada King, Countess of Lovelace, which is suitable for all development needs.

Ada has built-in features that directly support structured, object-oriented, generic, distributed and concurrent programming.

Ada is a good choice for Rapid Application Development, Extreme Programming (XP), and Free Software development.

Programming in the large

Ada puts unique emphasis on, and provides strong support for, good software engineering practices that scale well to very large software systems (millions of lines of code, and very large development teams). The following language features are particularly relevant in this respect:

  • An extremely strong, static and safe type system, which allows the programmer to construct powerful abstractions that reflect the real world, and allows the compiler to detect many logic errors before they become bugs.
  • Modularity, whereby the compiler directly manages the construction of very large software systems from sources.
  • Information hiding; the language separates interfaces from implementation, and provides fine-grained control over visibility.
  • Readability, which helps programmers review and verify code. Ada favours the reader of the program over the writer, because a program is written once but read many times. For example, the syntax bans all ambiguous constructs, so there are no surprises, in accordance with the Tao of Programming's Law of Least Astonishment. (Some Ada programmers are reluctant to talk about source code which is often cryptic; they prefer program text which is close to English prose.)
  • Portability: the language definition allows compilers to differ only in a few controlled ways, and otherwise defines the semantics of programs very precisely; as a result, Ada source text is very portable across compilers and across target hardware platforms. Most often, the program can be recompiled without any changes[2].
  • Standardisation: standards have been a goal and a prominent feature ever since the design of the language in the late 1970's. The first standard was published in 1980, just 3 years after design commenced. Ada compilers all support the exact same language; there are no dialects.

Consequences of these qualities are superior reliability, reusability and maintainability. For example, compared to programs written in C, programs written in Ada 83 contain ten times fewer bugs, and cost half as much to develop in the first place[3]. Ada shines even more in software maintenance, which often accounts for 80% of the total cost of development. With support for object-oriented programming, Ada95 brings even more cost benefits, although no serious study comparable to Zeigler's has been published.

Programming in the small

In addition to its support for good software engineering practices, which are applicable to general-purpose programming, Ada has powerful specialised features supporting low-level programming for real-time, safety-critical and embedded systems. Such features include, among others, machine code insertions, address arithmetic, low-level access to memory, control over bitwise representation of data, bit manipulations, and a well-defined, statically provable concurrent computing model called the Ravenscar Profile.

Other features include restrictions (it is possible to restrict which language features are accepted in a program) and features that help review and certify the object code generated by the compiler.

Several vendors provide Ada compilers accompanied by minimal run-time kernels suitable for use in certified, life-critical applications. It is also possible to write Ada programs which require no run-time kernel at all.

It should come as no surprise that Ada is heavily used in the aerospace, defense, medical, railroad, and nuclear industries.

The Language Reference Manual


The Ada Reference Manual (RM) is the official language definition. If you have a problem, if no one else can help, and you can find it, maybe you should read the RM (albeit often a bit cryptic for non-language-lawyers). For this reason, all complete (not draft) pages in Ada Programming contain links into the appropriate pages in the RM.

This tutorial covers Ada Reference Manual — ISO/IEC 8652:1995(E) with Technical Corrigendum 1:2001 and Amendment 1:2007 — Language and Standard Libraries, colloquially known as Ada 2005 or just Ada.

You can browse the complete Reference Manual at http://www.adaic.com/standards/05rm/html/RM-TTL.html

There are two companion documents:

The Ada Information Clearinghouse also offers the older Ada 83 and Ada 95 standards and companion documents.

The RM is a collective work under the control of Ada users. If you think you've found a problem in the RM, please report it to the Ada Conformity Assessment Authority. On this site, you can also see the list of "Ada Issues" raised by other people.

Ada Conformity Assessment Test Suite


Unlike other programming languages, Ada compilers are officially tested, and only those which pass this test are accepted, for military and commercial work. This means that all Ada compilers behave (almost) the same, so you do not have to learn any dialects. But because the Ada standard allows the compiler writers to include some additions, you could learn a cool new feature only to find out that your favorite compiler does not support it....

Programming in Ada

Reading a document online is often quite cumbersome. So if you just started you can also download All Chapters (PDF version) and print them out.

Getting Started

Where to get a compiler, how to compile the source, all answered here:

Language Features

These chapters look at the broader picture. They introduce you to the Ada features in a tutorial style.

Computer Programming

The following articles are Ada adaptations from articles of the Computer programming book. The texts of these articles are language neutral but the examples are all Ada.

Language Summary

Within the following chapters we look at foundations of Ada. These chapters may be used for reference of a particular keyword, delimiter, operator and so forth.