home *** CD-ROM | disk | FTP | other *** search
/ BURKS 2 / BURKS_AUG97.ISO / BURKS / LANGUAGE / ADA / LOVELACE / lesson1.les < prev    next >
Text File  |  1997-07-11  |  19KB  |  461 lines

  1. <COMMENT This is the lesson file for the Lovelace Ada tutorial, lesson 1.>
  2. <COMMENT A program called genlesson is used to transform this file into a set>
  3. <COMMENT of useful HTML files for use by Mosaic and other WWW browsers.>
  4.  
  5. <TUTOR NAME="Ada95 Lovelace">
  6. <LESSON NUMBER=1>
  7.  
  8. <COMMENT $Id: lesson1.les,v 1.10 1995/09/22 21:38:21 wheeler Exp wheeler $ >
  9.  
  10. <COMMENT A lesson is divided into 1 or more "sections".>
  11.  
  12. <SECTION NAME="What is Ada?">
  13. Ada is a computer programming language originally designed to support the
  14. construction of long-lived, highly reliable software systems.
  15. Its design emphasizes readability, avoids error-prone notation,
  16. encourages reuse and team coordination, and it is designed to be
  17. efficiently implementable.
  18. <P>
  19. <IMG SRC="nobug.gif" ALT="" HEIGHT=29 WIDTH=37 ALIGN=right>
  20. A significant advantage of Ada is its reduction of debugging time.
  21. Ada tries to catch as many errors as reasonably possible, as early as possible.
  22. Many errors are caught at compile-time by Ada that aren't caught or
  23. are caught much later by other computer languages.
  24. Ada programs also catch many errors at run-time if they can't be caught
  25. at compile-time (this checking can be turned off to improve performance
  26. if desired).
  27. In addition, Ada includes a problem (exception) handling mechanism so that
  28. these problems can be dealt with at run-time.
  29.  
  30. <H2>Who uses Ada?</H2>
  31.  
  32. Ada was originally designed for the U.S. Department of Defense (DoD) for
  33. real-time embedded systems.
  34. Ada is the most commonly used language in U.S. weapons systems
  35. <IFDEF BOOK>
  36. modernization [Hook 1995].
  37. <ELSE>
  38. modernization
  39. <A HREF="doduse.htm">(more
  40. information about the DoD use of Ada is available).</A>
  41. <ENDIF>
  42. <P>
  43. <IMG SRC="jet.gif" ALT="" HEIGHT=31 WIDTH=32 ALIGN=right>
  44. However, Ada's user base has expanded far beyond the U.S. DoD
  45. to many other areas such as
  46. large-scale information systems, distributed systems,
  47. and scientific computation.
  48. Major Ada niches include aerospace and safety-critical systems.
  49. An <A HREF="http://www.comlab.ox.ac.uk/archive/safety/lang-survey.html">informal
  50. 1994 survey</A>
  51. concluded that Ada was the most popular language for safety-critical systems.
  52. <P>
  53. People use Ada for small projects as well as large ones, since Ada's
  54. error-catching capabilities (both compile-time and run-time)
  55. significantly reduce debugging time.
  56. Also, Ada's parallel constructs can take advantage of today's more advanced
  57. operating systems (such as Microsoft's Windows NT, Windows 95, and Mach).
  58. <P>
  59. Many people use Ada when the application must run quickly.
  60. The Ada programming language was designed to be efficiently
  61. implementable, since one of its key application domains is in real-time
  62. embedded systems (where efficiency is critical).
  63. The actual efficiency of an Ada program, of course,
  64. depends on the the algorithms selected and the actual Ada compiler used.
  65. The first Ada compilers, like many other first compilers of a given language,
  66. generated inefficient code; modern Ada compilers
  67. generally generate relatively good code.
  68. Sadly, the performance of the initial Ada compilers created a myth of
  69. slow execution that is only beginning to disappear.
  70. The best test of efficiency, of course,
  71. is to benchmark a specific compiler with the
  72. type of problem you wish to solve.
  73.  
  74. <H2>Where and how is Ada standardized?</H2>
  75.  
  76. Ada was originally standardized by ANSI in 1983
  77. (ISO released an equivalent standard in 1987).
  78. Ada was recently revised to add some new capabilities;
  79. this revision is called `Ada 9X' or `Ada 95'.
  80. <!-- Its revision was actually completed in 1994, -->
  81. <!-- but due to paperwork delays at -->
  82. <!-- ISO it's technically considered a 1995 standard. -->
  83. Ada compiler vendors have generally updated their compilers to
  84. add the new Ada 95 features.
  85. This tutorial covers the capabilities of Ada 95, but will note which
  86. features are new to Ada 95.
  87. <P>
  88. <IMG SRC="book05.gif" ALT="" HEIGHT=33 WIDTH=33 ALIGN=right>
  89. Ada is officially defined in its <EM>reference manual</EM> (RM).
  90. <A HREF="http://www.adahome.com/rm95/rm9x-toc.html">The
  91. complete Ada 95 RM is available on-line as a hypertext document</A>.
  92. <IFDEF BOOK>
  93. If you have a web browser, you can read the Ada95 RM at URL
  94. "http://www.adahome.com/rm95/rm9x-toc.html".
  95. <ENDIF>
  96. However, the RM is not intended to be a tutorial and can be
  97. hard to understand if you're not already somewhat familiar with Ada.
  98. We will often refer to the RM, and feel free to look at it if you're
  99. interested in more detail about a particular subject.
  100. <P>
  101. Ada was not designed by a committee.
  102. The original Ada design was the winner of a language design competition;
  103. the winning team was headed by Jean Ichbiah
  104. (Ichbiah's language was called "Green").
  105. The 1995 revision of Ada (Ada 95)
  106. was developed by a small team led by Tucker Taft.
  107. In both cases, the design underwent a public comment period where the
  108. designers responded to public comments.
  109. <P>
  110.  
  111. <H2>What exactly are Ada's capabilities?</H2>
  112. <OL>
  113. <LI>Packages (modules) of related types, objects,
  114. and operations can be defined.
  115. <LI>Packages and types can be made generic (parameterized through a template)
  116. to help create reusable components.
  117. <LI>Errors can be signalled as exceptions and handled explicitly.
  118. Many serious errors (such as computational overflow and invalid
  119. array indexes) are automatically caught and handled
  120. through this exception mechanism, improving program reliability.
  121. <LI>Tasks (multiple parallel threads of control) can be created and communicate.
  122. This is a major capability not supported in a standard way by many
  123. other languages.
  124. <LI>Data representation can be precisely controlled to support
  125. systems programming.
  126. <LI>A predefined library is included; it provides input/output (I/O),
  127. string manipulation, numeric functions,
  128. a command line interface, and a random number generator
  129. (the last two were available in Ada 83, but are standardized in Ada 95).
  130. <LI>Object-oriented
  131. programming is supported (this is a new feature of Ada 95).
  132. In fact, Ada 95 is the first internationally
  133. standardized object-oriented programming language.
  134. <LI>Interfaces to other languages (such as C, Fortran, and COBOL)
  135. are included in the language (these have been significantly
  136. enhanced in Ada 95).
  137. <IFDEF BOOK>
  138. At least one Ada compiler (from Intermetrics)
  139. can generate Java Virtual Machine (J-code)
  140. from Ada, so people can use Ada to develop Java applets and applications.
  141. <ELSE>
  142. At least one Ada compiler (from Intermetrics)
  143. can generate Java Virtual Machine (J-code)
  144. from Ada, so people can
  145. <A HREF="java.htm">use Ada
  146. to develop Java applets and applications</A>.
  147. <ENDIF>
  148. </OL>
  149.  
  150. <H2>What's available for Ada?</H2>
  151. <P>
  152. There are
  153. <A HREF="http://www.adahome.com/Resources/Compilers/Compilers.html">many
  154. Ada compilers</A>, including
  155. <A HREF="http://www.adahome.com/Resources/Compilers/GNAT.html">a
  156. free Ada 95 compiler called GNAT
  157. based on the Free Software Foundation's gcc</A>.
  158. <A HREF="http://www.adahome.com/Resources/Tools/Tools.html">There
  159. are also many Ada-related tools</A>
  160. and
  161. <A HREF="http://www.adahome.com/Resources/References.html">on-line
  162. reference documents</A>.
  163. <A HREF="s14sf.htm">A later section of this tutorial
  164. <IFDEF BOOK>
  165. (lesson 14)
  166. <ENDIF>
  167. provides more information about on-line Ada information sources.</A>
  168.  
  169. <QUESTION Type=Multiple-Choice>
  170. Which of the following is <EM>not</EM> an Ada capability?
  171. <CHOICES>
  172. <CHOICE ANS=1>Reduce errors and debugging time through early detection
  173. <CHOICE ANS=2>Object-oriented programming
  174. <CHOICE ANS=3>Efficiently implementable
  175. <CHOICE ANS=4>None of the above - Ada has all three of these capabilities.
  176. </CHOICES>
  177. <ANSWER ANS=4>
  178. <RESPONSES>
  179. <WHEN ANS=1>
  180. No, sorry.
  181. Error reduction is an important capability of Ada.
  182. Ada constructs have been specifically designed to help detect
  183. errors as early as possible.
  184. <WHEN ANS=2>
  185. No, sorry, that's not right.
  186. It <EM>is</EM> true that the older Ada 83 didn't completely support
  187. object-oriented (OO) programming.
  188. Ada 83 was the closest non-OO programming language to support OO programming,
  189. and so it was often called an `object-b