Ada

Views:
 
Category: Education
     
 

Presentation Description

No description available.

Comments

Presentation Transcript

Slide 1: 

Ada

Slide 2: 

History Major Constructs

Slide 3: 

Strengths and Weaknesses

Slide 4: 

Simple Program Complex Program

Slide 5: 

History ADA was named after Lady Augusta Ada Byron, the Countess of Lovelace (1815-1852), who is often credited as being the first computer programmer. She is also a mathematician and the daughter of the poet Lord Byron. It has been thirty-six years since the first efforts to achieve a common high-order language were proposed. In 1974, The Army began a study called Implementation Language for Real Time Systems. The Navy called theirs the CS4 Program. The Air Force effort was named the High Order Language Standardization Study.

Slide 6: 

A high-order language working group (HOLWG) was formed with Whitaker as chairman. By the spring of 1975, the working group had begun determining the characteristics of a general-purpose programming language suitable for embedded computer applications. The characteristics were to be given in the form of requirements that would act as constraints on the acceptability of a language but would not dictate specific language features. The requirements were not a language specification, but instead they attempted to define rigorously the needed characteristics in a form that could be critically reviewed.

Slide 7: 

1975 – Strawman General goals were listed including efficiency, reliability, readability, simplicity, and implementability. None of these features was quantifiable; however, it was decided that no specific language features would be adopted at that time since those types of requirements would impose strong constraints on the form without necessarily increasing the effectiveness of the languages.

Slide 8: 

August 1975 - Woodenman Also contained were descriptions of the general, or nonquantifiable, desired characteristics. It also contained many other welcome characteristics whose feasibility, practically, and mutual compatibility had not been tested.

Slide 9: 

January 1976 – Tinman By David Fisher. The Tinman removed the requirements for which there was no sound rationale, restricted unnecessarily general requirements, and modified others to be practical within existing technology

Slide 10: 

January 1977 – Ironman was discursive and organized around general areas of discussion. Ironman, on the other hand, was very brief and organized like a language description or manual. It was essentially a specification with which to initiate the design of a language.

Slide 11: 

In July 1977, with Ironman complete, the DOD held a design competition, and most of the fifteen proposals received, including the four best, were based on Pascal. The four top designs: Cii-Honeywell Bull (green; led by Jean Ichbiah) Intermetrics (red; led by Benjamin Brosgol) SofTech (blue; led by John Goodenough) SRI International (yellow; led by Jay Spitzen)began parallel design efforts in August 1977; each of the teams was coded with a color to preserve anonymity during the source selection.

Slide 12: 

1978 – Steelman In 1978, the four designs were evaluated by 125 design review teams from around the world. In addition, the contractors were required to defend their designs in intensive oral examinations. Based on the language reports, the next version of the requirements specification is the Stoneman document, and was released in February 1980.

Slide 13: 

Hey Heidi! Discuss the Major Construct now..  YES! And for the Major Constructs

Slide 14: 

Major Constructs Ada Programming Type System Predefined Types - There are several predefined types, but most programmers prefer to define their own, application-specific types. These types are predefined in the Standard package: Integer Float Duration Character String Boolean

Slide 15: 

Ada Programming Control Conditionals - Conditional clauses are blocks of code that will only execute if a particular expression (the condition) is true. if-else if condition then statement; else other statement; end if; Optimizing hints - In Ada, conditional statements with more than one conditional do not use short-circuit evaluation by default.

Slide 16: 

2. Unconditionals - Unconditionals let you change the flow of your program without a condition. return - End a function and return to the calling procedure or function. For procedures: return; For functions: return Value; goto- Goto transfers control to the statement after the label.

Slide 17: 

3. Loops - Loops allow you to have a set of statements repeated over and over again. Endless Loop Loop with condition at the beginning Loop with condition at the end Loop with condition in the middle for loop For_Loop : for I in Integer range 1 .. 10 loop Do_Something (I) end loop For_Loop; for loop on arrays: Array_Loop :for I in X'Range loop X (I) := Get_Next_Element; end loop Array_Loop; the value cannot be changed. The following is illegal. for i in 1 .. 10 loop i := i + 1; end loop;

Slide 18: 

Ada Programming Packages Separate compilation Parts of a package The package specification — the visible part package Public_Only_Package is  type Range_10 is range 1 .. 10; end Public_Only_Package; The private part The private part of a package serves two purposes: To complete the deferred definition of private types and constants. To export entities only visible to the children of the package

Slide 19: 

The package body - The package body defines the implementation of the package. 3. Using packages - To utilize a package it's needed to name it in a with clause, whereas to have direct visibility of that package it's needed to name it in a use clause. Standard with - The standard with clause provides visibility for the public part of a unit to the following defined unit.

Slide 20: 

JR? Still alive? Do your part now! :P Sure babe! ;)

Slide 21: 

Weaknesses Strengths and

Slide 22: 

Strengths It is also easy to extend someone else’s work without affecting its original source code. That is why Ada 95 was a popular choice for introductory computer science course. It supports enumerated types, operator overloading for infix operators and “in” “out” and “in out” to document the use of parameters. It supports numeric range checks more specific to detect errors that the other language does not have Support for object-oriented programming, strong real-time building blocks, and for you to have more direct access on the hardware system. Source code is easier to understand than the other programming language. Tend to have fewer errors than the other programming language. Before, compilers were expensive that’s why only few programmers used Ada, but now, there are free and inexpensive compilers that are compatible to Ada.

Slide 23: 

Weaknesses The source code is hard to read Notices each bounded length string has a different type which makes the program hard to manage. Requires to run dynamically linked library, meaning, library should be installed or you could just generate statically linked programs but that makes the program larger. It is difficult to look for compilers.

Slide 24: 

Uhm? Simple Program  Uh yea.. 

Slide 25: 

Simple Program WITH Ada.Text_IO, Ada.Integer_Text_IO; USE Ada.Text_IO, Ada.Integer_Text_IO; PROCEDURE Easy IS Num : Integer; Prim : Integer := 0; BEGIN Put("Enter number: "); Get(Num); -- even New_line; Put("Even numbers are: "); New_line; for X in 1..num loop IF(X MOD 2 = 0) then Put(X); End IF; END LOOP; -- odd New_line; Put("Odd numbers are: "); New_Line; FOR X IN 1..Num LOOP IF(X MOD 2 /= 0) then Put(X); END IF; END LOOP; --prime New_line; Put("Prime numbers are:"); New_line; for x in 2..num loop for y in 2..num loop if ( x /= y AND x MOD y = 0) then prim:= 1; exit; end if; end loop; if (prim = 0) then put(x); end if; prim := 0; end loop; end easy;

Slide 27: 

FRIEND! Complex! Surely! 

Slide 28: 

Complex Program WITH Ada.Text_IO; USE Ada.Text_IO; WITH ADA.Integer_Text_IO; USE ADA.Integer_Text_IO; PROCEDURE Calculator IS Option: Character; X, Y : Integer; Try: Character; Fac : Integer := 1; R1 : Float := 0.0; BEGIN <<Menu>> Put_Line("*******************************************"); Put_Line(" CALCULATOR "); Put_Line("*******************************************"); Put_line("[+] - Addition"); Put_Line("[-] - Subtract"); Put_Line("[*] - Multiply"); Put_Line("[/] - Divide"); Put_Line("[%] - Modulus"); Put_Line("[f] - factorial"); New_Line; Put("Enter your choice: "); Get(Option); IF Option = '+' THEN New_line; Put_Line("**************************"); Put_Line(" Addition"); Put_Line("**************************"); New_Line; Put("Enter first number: "); Get(X); Put("Enter second number: "); Get(Y); New_Line; Put("Sum: "); Put(X+Y); New_Line; New_Line; Put_Line("**************************"); goto Again;

Slide 29: 

ELSIF Option = '-' THEN New_line; Put_Line("**************************"); Put_Line(" Subtraction"); Put_Line("**************************"); New_Line; Put("Enter first number: "); Get(X); Put("Enter second number: "); Get(Y); New_Line; Put("Difference: "); Put(X-Y); New_Line; New_Line; Put_Line("**************************"); goto Again; ELSIF Option = '*' THEN New_line; Put_Line("**************************"); Put_Line(" Multiplication"); Put_Line("**************************"); New_Line; Put("Enter first number: "); Get(X); Put("Enter second number: "); Get(Y); New_Line; Put("Product: "); Put(X*Y); New_Line; New_Line; Put_Line("**************************"); GOTO Again; ELSIF Option = '/' THEN New_line; Put_Line("**************************"); Put_Line(" Division"); Put_Line("**************************"); New_Line; Put("Enter first number: "); Get(X); Put("Enter second number: "); Get(Y); New_Line; Put("Quotient: "); Put(X/Y); New_Line; New_Line; Put_Line("**************************"); GOTO Again;

Slide 30: 

ELSIF Option = '%' THEN New_line; Put_Line("**************************"); Put_Line(" Division"); Put_Line("**************************"); New_Line; Put("Enter first number: "); Get(X); Put("Enter second number: "); Get(Y); New_Line; Put("Modulus Divisor: "); Put(X MOD Y); New_Line; New_Line; Put_Line("**************************"); GOTO Again; ELSIF Option = 'f' THEN New_line; Put_Line("**************************"); Put_Line(" Factorial"); Put_Line("**************************"); New_Line; Put("Enter number: "); Get(X); New_Line; Put("Factorial: "); FOR Y IN 1..X LOOP Fac := Fac * Y; END LOOP; Put(Fac); New_Line; New_Line; Put_Line("**************************"); fac := 1; GOTO Again; ELSIF Option = 'r' THEN New_line; Put_Line("**************************"); Put_Line(" Square Root"); Put_Line("**************************"); New_Line; Put("Enter number: "); Get(X); New_Line; Put("Square Root: "); R1 := Sqrt(X); Put("R1"); Put(Fac); New_Line; New_Line; Put_Line("**************************"); GOTO Again;

Slide 31: 

ELSE Put_Line("Choose from the choices. "); GOTO Menu; END IF; <<Again>> New_Line; New_Line; Put("Try Again? (y/n): "); Get(Try); CASE Try IS WHEN 'y' => New_Line; New_Line; New_Line; New_Line; New_Line; GOTO Menu; WHEN 'Y' => New_Line; New_Line; New_Line; New_Line; New_Line; GOTO Menu; WHEN 'n' => Put("Thank you for using."); WHEN 'N' => Put("Thank you for using."); WHEN OTHERS => Put_Line("Enter y or n only."); New_Line; New_Line; New_Line; New_Line; New_Line; GOTO Again; END CASE; end calculator;