Pages

Saturday, August 11, 2012

AdaTutor - Introduction

What Is Ada?

Ada is a modern language designed for programming large scale and real time
systems. Ada is also an excellent general purpose language. It has many new
features which help prevent errors and detect errors earlier.

However, Ada is much more than a programming language. It's also a different programming
philosophy. Beware of learning just "Ada syntax"; you'll wind up writing
Basic-like (or Pascal-like, etc.) programs that happen to be coded in Ada. If
you do that, you'll lose the many benefits of Ada. Unfortunately, you won't
see why Ada is a different programming philosophy until later in this course. (By
the time we get to packages and information hiding, you'll be an enthusiastic
convert.) In the meantime, please take our word for it: Ada is a whole new
programming philosophy, not just another language.

Because of its many features, Ada is relatively complicated. There's about
seven times as much to learn as Pascal. However, the effort pays great
dividends. Once you learn the language, Ada programs are easier to write,
easier to read, and much easier to modify a month or a year later.

A Very Brief History of Ada

Ada was named for Augusta Ada Byron, countess of Lovelace and daughter of the
poet Lord Byron. She worked with Charles Babbage on his Analytical Engine, and
has been called the world's first programmer.

Ada was invented because the U.S. Department of Defense (DoD) realized that
none of the existing languages was very suitable for real-time control of
large, embedded systems. An embedded system is a computer system inside a
product other than a computer, such as an intelligent oven or a guided missile.
Programs for embedded systems are usually written with a cross compiler, a
compiler that runs on one machine and produces code for another. Cross
compilers are often called compilers for short.

In 1977 the DoD issued a Request for Proposal to develop a new language; the
leading four contenders were designated Blue, Red, Yellow, and Green.
Eventually Green was selected to be Ada; it was designed by the company
Honeywell Bull under the direction of Jean Ichbiah of France.

What Are Ada 83 and Ada 95?

The Ada language was standardized in 1980, and revised in 1983 and in 1995.
The present version of Ada is called Ada 95, the previous version, Ada 83.

During the early 1990's, it wasn't certain exactly when in the 90's the second
revision of Ada would be completed, so the upcoming revision was referred to as
Ada 9X. Any references you see elsewhere to "Ada 9X" mean Ada 95.

Since March 1997, all validated Ada compilers are Ada 95 compilers; the
validation on all Ada 83 compilers has expired. The meaning of "validation"
will be discussed very shortly.

AdaTutor will point out the differences between Ada 83 and Ada 95 as we go
along. All of the programs and examples in this course are designed to compile
and run with either an Ada 83 or an Ada 95 system, except for the examples
specifically labeled as Ada 95 only.

Question

In the author's opinion, which one of the following statements is true?

No, Ada is more complicated than Pascal. So far as the philosophy is concerned, Ada is an extension (or "superset") of Pascal. However, in syntax Ada isn't a superset of Pascal; the Ada syntax is different.

Although Ada is more complicated than Pascal (and many other languages), it has
many advantages. These advantages pay dividends in reduced effort to develop
and maintain programs.

No, Ada has a reputation for
detecting errors earlier than the simpler languages.
Ada detects errors at compile time that other languages detect only at run time or not at all. Examples are calling a subprogram with the wrong number of parameters, and
unintentionally mixing different types in an expression.
We'll learn more about these things later.

What's a "Validated" Ada Compiler?

Ada compilers (and cross compilers) are now validated by the National Institute
of Standards and Technology (NIST). If a compiler conforms exactly to the
standard, and isn't a subset or superset of Ada, it's validated after passing
an extensive suite of tests (called the Ada Compiler Validation Capability, or
ACVC). The ACVC is updated periodically.

Since March 1997, all validated compilers conform to the newer Ada 95 standard,
because the validation on all Ada 83 compilers has expired.

Question

True or
False? Subsets and supersets of standard Ada may be called "Ada."

You're right!
Compilers not conforming exactly to the Ada standard may be called "Ada" if the documentation
contains a clear statement that they don't conform.

Of course, validated compilers can't be subsets or supersets of standard Ada. They must conform exactly to the standard to be validated.

True. It's a common misconception
that subsets and supersets may not be called "Ada."
However, this was allowed even when "Ada" was a DoD trademark.
Compilers not conforming to the standard may be called "Ada" if there's a clear
statement that they don't conform.

It's true, however, that validated Ada compilers can't be subsets or supersets
of standard Ada.

True or
False? The Validation tests are performed to provide reasonable assurance that a compiler is bug-free.

False. That's a common
misconception, but validation only determines that a compiler conforms exactly to the Ada
standard, and isn't a subset or superset. A compiler isn't believed to be bug-free just
because it earned a Validation Certificate.

You're right! The Validation tests are performed to make sure that a
compiler conforms to the Ada standard, and isn't a subset or superset. A compiler isn't
believed to be bug-free just because it earned a Validation Certificate./p>