Search This Blog

Thursday, 26 September 2013

Ada

      Starting in the 1960s, the U.S. Department of Defense  (DOD) began to confront the growing unmanageability of  its software development efforts. Whenever a new application such as a communications controller (see embedded system) was developed, it typically had its own specialized programming language. With more than 2,000 such  languages in use, it had become increasingly costly and  difficult to maintain and upgrade such a wide variety of  incompatible systems. In 1977, a DOD working group began  to formally solicit proposals for a new general purpose programming language that could be used for all applications  ranging from weapons control and guidance systems to barcode scanners for inventory management. The winning language proposal eventually became known as Ada, named  for 19th-century computer pioneer Ada Lovelace see also  babbage, chaRles). After a series of reviews and revisions  of specifications, the American National Standards Institute  officially standardized Ada in 1983, and this first version of the language is sometimes called Ada-83.

Language Features
     In designing Ada, the developers adopted basic language  elements based on emerging principles (see stRuctuRed programming) that had been implemented in languages developed during the 1960s and 1970s (see algol and pascal). These elements include well-defined control structures (see bRanching statements and loop) and the avoidance of the haphazard jump or “goto” directive.

     Ada combines standard structured language features (including control structures and the use of subprograms) with user-definable data type “packages” similar to the classes used later in C++ and other languages (see class and object-oRiented pRogRamming). As shown in this simple example, an Ada program has a general form similar to that used in Pascal. (Note that words in boldface type are language keywords.)

with Ada.Text_IO; use Ada.Text_IO;
procedure Get_Name is
Name : String (1..80);
Length : Integer;
begin
Put (“What is your first name?”);
Get_Line (Name, Length);
New_Line;
Put (“Nice to meet you,”);
Put (Name (1..Length));
end Get_Name;

     The first line of the program specifies what “packages”  will be used. Packages are structures that combine data  types and associated functions, such as those needed for  getting and displaying text. The Ada.Text.IO package, for example, has a specification that includes the following:

package Text_IO is
type File_Type is limited private;
type File_Mode is (In_File, Out_File, Append_File);
procedure Create (File : in out File_Type;
Mode : in File_Mode := Out_File;
Name : in String := “”);
procedure Close (File : in out File_Type);
procedure Put_Line (File : in File_Type; 
Item : in String);
procedure Put_Line (Item : in String);
end Text_IO;

     The package specification begins by setting up a data type for files, and then defines functions for creating and closing a file and for putting text in files. As with C++ classes, more specialized packages can be derived from more general ones.

     In the main program Begin starts the actual data processing, which in this case involves displaying a message using the Put function from the Ada.Text.IO function and getting the user response with get_Line, then using Put again to display the text just entered.

     Ada is particularly well suited to large, complex software  projects because the use of packages hides and protects the  details of implementing and working with a data type. A  programmer whose program uses a package is restricted to  using the visible interface, which specifies what parameters are to be used with each function. Ada compilers are carefully validated to ensure that they meet the exact specifications for the processing of various types of data (see data types), and the language is “strongly typed,” meaning that types must be explicitly declared, unlike the case with C, where subtle bugs can be introduced when types are automatically converted to make them compatible.

     Because of its application to embedded systems and realtime operations, Ada includes a number of features designed  to create efficient object (machine) code, and the language  also makes provision for easy incorporation of routines written in assembly or other high-level languages. The latest official version, Ada 95, also emphasizes support for parallel programming (see multipRocessing). The future of Ada is unclear, however, because the Department of Defense no longer requires use of the language in government contracts.

     Ada development has continued, particularly in areas including expanded object-oriented features (including support for interfaces with multiple inheritance); improved handling of strings, other data types, and files; and refinements in real-time processing and numeric processing.

No comments:

Post a Comment