home *** CD-ROM | disk | FTP | other *** search
/ Programmer's ROM - The Computer Language Library / programmersrom.iso / ada / message / gmhftr.doc < prev    next >
Encoding:
Text File  |  1988-05-03  |  25.7 KB  |  485 lines

  1. ,type 106
  2. type 86 86 86 86 
  3. ,end
  4.                                                        73503-85U/P7046
  5.                                                         15 April 1985
  6.  
  7.  
  8.  
  9.                        FINAL TECHNICAL REPORT
  10.  
  11. 1.0 INTRODUCTION
  12.  
  13.     This report has been prepared under contract #N66001-84-C-0425
  14. by Veda Incorporated to meet the requirements of paragraph C.4.5.2 of
  15. the Statement of Work. 
  16.  
  17.     The purpose of this report is to "...summarize experiences in Ada
  18. software engineering with emphasis on ways to streamline the
  19. documentation process to support distributed software engineering in
  20. a network culture". In addition, recommendations for new documentation
  21. methods, standards, and supporting tools were solicited.
  22.  
  23.     In Section 2 we describe and summarize our experiences with using
  24. Ada, in the context of the Telesoft compiler, version 2.1. We speak
  25. from the position of software engineers fairly knowledgeable about Ada
  26. but with little real hands-on experience in its use as a HOL in
  27. significant applications. We feel that our experiences should be of
  28. interest to others who are about to begin their first complicated
  29. software development in Ada.
  30.  
  31.     In Section 3 we offer our recommendations for future activities,
  32. methods, etc to the Ada community. We see several steps that DOD might
  33. take, both to support the goal of more efficient software development,
  34. and to encourage the voluntary use of Ada.
  35.  
  36. 2.0 LESSONS LEARNED.
  37.  
  38.     It is probably worthwhile to describe the project team. It consisted
  39. of three software engineers. The project manager has a PhD in
  40. mathematics,fifteen years of experience in software development and
  41. engineering, and has been studying Ada, using it as a PDL, going to
  42. symposia, etc since 1979. He was the designer for the earlier versions
  43. of the editor products. The second member of the team is a computer
  44. science major with two years experience. He has been reading about Ada
  45. since college, and has production-level experience (high fluency) with
  46. both Pascal and PL/I. He was also involved with the last two editor
  47. products. The final team member is an engineer with five years of
  48. software engineering experience, mostly on embedded systems. He has
  49. used Ada as a PDL and has attended tutorials.
  50.  
  51.     We can segment our experiences into three groups: those elements
  52. which are primarily application dependent; those which are descriptive
  53. of Ada as a software engineering asset; and those which relate to
  54. the specific Ada environment in which this project was conducted.
  55.  
  56. 2.1 Application Specific Experiences.
  57.  
  58.     The output of this effort is a formatted message handling system,
  59. and a generic message editor definition. The validity of these products
  60. is demonstrated by two instances of the generic, one for RAINFORM
  61. messages and one for UNITREP messages. The reader may wish to refer to
  62. the Generic Message Handling Facility (GMHF) Functional Description (FD)
  63. for further details.
  64.  
  65.    The primary aspect of GMHF which is of interest is its use of an
  66. extremely sophisticated generic definition. Other aspects include the
  67. use of generics and predefined Ada packages for user input, the use of
  68. command (function) keys on top of the standard Ada I/O routines, and the
  69. use of a terminal definition which supports portability.
  70.  
  71.    Recall that the purpose of this contract is to generate viable
  72. applications in Ada from existing products developed in other languages.
  73. Therefore, it is relevant to address our thoughts on rehosting into Ada.
  74. In any rehost, whether between languages or between computers, there is
  75. always some element of redesign. This may be a requirement of the new
  76. environment, it may be done to fix outstanding problems, or it may just
  77. be that the rehosters want to fiddle with and (hopefully) improve things
  78. a bit. 
  79.  
  80.     In rehosting from a simple language to a complex one, the optimal
  81. strategy is to find the proper balance between using the existing
  82. strengths of the software (i.e. not making a lot of changes) and using
  83. the strengths of the new language (i.e. redesigning to take advantage of
  84. the new language features). We found it easy to find a good balance
  85. in those areas of most maturity in the existing software. Since we were
  86. essentially turning version 3 of a FORTRAN product into version 4 in
  87. Ada, most of the components had a stable proven design, and were highly
  88. modular in construction. Thus from the bottom up, the job was relatively
  89. easy, and the code generation proceeded rapidly on existing functions.
  90. The impact of Ada was felt mostly at the highest levels of the system.
  91.  
  92.     From the top down, the structure in which the basic editor lives,
  93. was redesigned to take advantage of Ada's ability to define complex
  94. data types, use linked lists (access), and define generic components.
  95. Over all of this was the ability to logically segment chunks of the
  96. system into packages. The fact that the package structure we delivered
  97. is not that which we started with is indicative of the fact that
  98. packages are useful and can tend to proliferate. We experimented with
  99. group development by developing the specification for the PRINT_PACKAGE
  100. and assigning it to one of the team who could not then discuss it with
  101. the others. Not only did it work well, but it convinced us to make some
  102. changes in the way we assign tasks in our FORTRAN development efforts.
  103.  
  104.     The generic editor definition was by far the largest new item. It
  105. embodies most typical formatted message editor functions, but allows
  106. an implementor to define a message standard and some related items
  107. and instantiate a new version of the editor for that type. This can
  108. be a simple process or a complex one depending on the complexity and
  109. size of the message standard and the number of existing implementation
  110. specific tools which can be reused. We found that in doing our second
  111. instantiation, we could borrow much from our first. In particular, an
  112. implementor may find useful several utilities which support the
  113. instantiation process and which have been delivered. The use of generics
  114. in this application may be close to the edge of the current envelope.
  115.  
  116.     Standard message lines typically have fields whose content is
  117. strictly limited. These are called 'fixed fields'. An example is
  118. a month field whose contents must be one of the strings "JAN" ...
  119. "DEC". Ada supports these field types beautifully through user
  120. defined enumerated types. Then the built-in (TEXT_IO.ENUMERATION_IO or
  121. the value clause) facilities may be used and substantial software
  122. development avoided. Also, it makes the validation process much simpler,
  123. as only the type definition must be 'proof-read' and an instance of the
  124. generic tested. This is as opposed to 'by-hand' testing of input
  125. routines for each field type. The only negative here is that the items
  126. of an enumerated type must either take the form of an Ada identifier or
  127. be a character literal. It often happens, however, that a fixed field
  128. might have an entry which: a) begins with a digit, or b) contains
  129. characters other than just letters, digits, and underscores, or c) is
  130. an Ada reserved word. In any of these cases, work-arounds must be used.
  131. While the work-arounds are easy to manage, they are kludges and Ada
  132. should minimize the requirement to kludge.
  133.     
  134.  
  135.  
  136. 2.2 General Experiences using Ada as a HOL.
  137.  
  138.     We found the built-in generics to be extremely useful, and found
  139. ourselves genericizing elements throughout the development process.
  140. The only negative aspects of generics we encountered are discussed in 
  141. paragraph 2.3 below. Other built-in features which proved extremely
  142. worthwhile are the attributes associated with various constructs; for
  143. example the pos, value, and image attributes. These allow the programmer
  144. powerful tools to access the aspects of a type or object.
  145.  
  146.     Packaging is probably that aspect of Ada that is most important,
  147. at least within our experience on this effort. Properly done, packages
  148. support compartmentalized development by allowing agreement on specs
  149. as a contract between components. This requires that package specs
  150. must be VERY CAREFULLY defined. We found that by keeping the
  151. declarations in any spec to a minimum, and defining other entities in
  152. the body, confusion between programmers was minimized. 
  153.  
  154.     At the same time that the specifications are designed, care should
  155. be taken to minimize the number of packages which must be linked using
  156. a 'with' clause. The more packages that are linked to the specification
  157. of any given package, the higher the probability that the given package
  158. will have to be recompiled due to a recompilation of one of the 'withed'
  159. packages. Such unnecessary recompilations chain together and can be
  160. extremely time consuming.
  161.  
  162.     Packages also support debugging by allowing the tester to localize
  163. problems. Here, exceptions are very useful, as a production tool
  164. certainly, but as debugging tools as well. We found that if one avoided
  165. the others clause during development/debugging, it illuminated the whole
  166. process, while when we used the "when others =>" in an exception handler
  167. it tended to obscure exactly what/where the exception was occurring.
  168.  
  169.     Separate compilation of package specs and bodies is not available
  170. in some of the "almost-Ada" subsets we've seen. For a fairly large
  171. application, this is a crucial feature. It allows the developer to
  172. separate, in his mind, the 'what' from the 'how'. That separation is
  173. extremely important. As future software development requirements
  174. continue to outstrip capability, more and more code will be developed
  175. by relatively inexperienced personnel - a fact of life. Junior
  176. programmers usually have a great deal of difficulty in separating
  177. what has to be done, and how one might choose to do it. Separate
  178. compilation of specs and bodies helps (forces) them to keep this in
  179. mind. It keeps implementation decisions from insiduously creeping
  180. throughout a system. Furthermore, if something does get implemented
  181. poorly, it minimizes the cost and risk in fixing it. (We at Veda are
  182. all outstanding software engineers, but we can extrapolate ...)
  183.  
  184.     While trying to avoid twenty pages of motherhood on how great
  185. Ada is, I do feel compelled to mention the importance of user
  186. defined data types in applications such as ours. For many real-time
  187. types of applications, they may not have much impact, but for message
  188. handlers, and other C3 applications they are crucial. In no other
  189. language can one RATIONALLY define the data types being used, and
  190. ensure (redefines) that apples are not inadvertently mixed with oranges.
  191. In an area where the structure and validity of the data are of utmost
  192. importance, only Ada supports data definition adequately. Those
  193. familiar with highly classified message types can appreciate the impact
  194. of the features mentioned above, and the definition of private types,
  195. on software development and ADP security. In this connection, users must
  196. get in the habit of using Ada's data typing facilities. It is easy to
  197. regress into using obscurely named or ill-defined data elements for
  198. "quick-and-dirties" or for "debugging-only". In the long run, it appears
  199. to us to be much more time effective to think out and clearly name all
  200. data elements, even those which may be expected to have a short
  201. "half-life".
  202.  
  203.  
  204. 2.3 Ada in the Telesoft/VAX environment.
  205.  
  206.     There are two ways to deal with this subject. One way would be a
  207. diatribe against Telesoft listing every problem and detailing how much
  208. it cost us in time and design coherency. We choose rather to try to
  209. be a little more general, and focus on the kind of environmental
  210. parameters which can cause problems.
  211.  
  212.     The first, and most general, comment is that the LRM defines a
  213. language with great specificity. It leads designers to believe that
  214. they can design to it. However, one can only design to an implementation
  215. which may or may not meet all of the specification. Areas where a
  216. specific implementation are lacking must be fully defined, even to the
  217. extent of raising questions about areas that are thought to be ok but
  218. might not be. It is extremely frustrating to base a design on some
  219. feature(s) of the language and find that that feature is not yet
  220. implemented. The way to avoid these frustrations is to be sure you
  221. have detailed information on the state of the implementation to be used,
  222. and to carefully and completely assess the impact of any implementation
  223. deficiencies prior to beginning any serious design work.
  224.  
  225.     The second thought is that one does not ask an auto manufacturer
  226. to build cars without a sophisticated set of tools. In the same sense,
  227. one must not ask software engineers to build complicated pieces of
  228. software without adequate tools. We have all been impatient to get our
  229. hands on Ada. There is a real risk that if those who are less than
  230. enthusiastic about the language (and possibly the concept) are faced
  231. with a first foray into Ada with compilers which are abysmally slow and
  232. which have numerous documented (and undocumented?) bugs, they will
  233. become active antagonists, rather than enthusiastic supporters and
  234. users.
  235.  
  236.    The specific problems which caused us the most grief are listed
  237. below. Others who are just beginning a development might take heed.
  238.  
  239.     * Slow compilation speed.
  240.  
  241.     * Requires too much time to link
  242.  
  243.     * Limitation on size of .COD segments (require kludges)
  244.  
  245.     * Lack of nested generics (caused major redesign)
  246.  
  247.     * Lack of incomplete type definitions within generics (ditto)
  248.  
  249.     * Lack of separate compilation for generic subunits
  250.                                                     (severe time impact)
  251.  
  252.     * Bugs in ENUMERATION_IO and VALUE clause (require kludges)
  253.  
  254.     * Too many "too many jumps" (require kludges)
  255.  
  256.     * Various library bugs
  257.  
  258.  
  259. 2.4 Productivity in Ada.
  260.  
  261.     We did not perform a controlled, scientific study on programmer
  262. productivity; the end result of this effort was to be code. However,
  263. our experience with Ada produced such striking results that we feel
  264. that they are worthy of documentation, even if informally.
  265.  
  266.     A major concern with Ada has been the amount of "up-to-speed" time
  267. required. Our ability to complete the effort within the calendar time
  268. frame allowed was of some concern due to this requirement for knowledge
  269. assimilation and integration. In fact, we found the time required to
  270. become proficient in Ada was much less than we would have expected, even
  271. given the fact that the project team consisted of experienced software
  272. engineers. Each of the team was developing code efficiently within 2-3
  273. weeks of his first compile.
  274.  
  275.     There are (at least) two relevant measures of programmer
  276. productivity: lines of code generated per day, and the number of lines
  277. of code generatable automatically for future applications. The GMHF team
  278. generated over 5 Ada statements per man hour. That does not include the
  279. over 7000 comment lines also written. During those man hours,
  280. significant design work was accomplished (this was not as simple a
  281. rehost as some others) and well over 1000 lines of documentation
  282. written. We feel that this is amazing, especially considering that none
  283. of the team had any previous production-level coding experience with
  284. Ada, and that none had ever seen the Telesoft compiler until two months
  285. after contract inception.
  286.  
  287.     The second parameter is less usual than statements per hour, but
  288. just as, if not more, important. The central element of this application
  289. was the generic definition of message types and message editors. As
  290. mentioned above, we developed the structure, instantiated the Rainform
  291. editor, and then instantiated the Unitrep editor. Furthermore, the team
  292. member who instantiated the Unitrep editor had not been involved with
  293. the development of the generic definition or with the editor portion of
  294. the system. (He had developed the Print Package). He completely
  295. instantiated the Unitrep editor in approximately 60 man hours. This
  296. resulted in over 1100 "executable" statements and approximately 1600
  297. data definition statements. About 900 of the data definition statements
  298. were gotten from SAIC (another example of reuse of Ada code). Even if
  299. these are not counted, the statements per hour figure ends up at over
  300. 30. The programmer involved feels that he could easily instantiate
  301. another message type of complexity similar to Unitrep in half the time
  302. it took him to do Unitrep. Thus not only has Ada code generation proved
  303. much more efficient than anyone had hoped, but code reusability can
  304. substantially improve efficiency in ways impossible in any language
  305. but Ada.
  306.  
  307.  
  308. 3.0 RECOMMENDATIONS.
  309.  
  310.     There are two groups of recommendations offered below. First, and
  311. perhaps most important, we offer some general recommendations for future
  312. development of Ada tools and facilities, and in one case for the
  313. evolution of the language itself. The second group of recommendations
  314. are GMHF specific, and are only of interest to potential GMHF users, and
  315. to those with some interest in the areas of applied research that GMHF
  316. represents.
  317.  
  318. 3.1 General Recommendations.
  319.  
  320.     At some point in the future, the Ada specification will be thawed -
  321. unfrozen at least to some extent, or there will be a "follow-on" next
  322. version of a language for embedded applications. Our application dealt
  323. primarily with data structures, and particularly with enumerated types.
  324. We would strongly recommend that when input is being gathered as to what
  325. improvements might be made in the language itself, consideration be
  326. given to specifying that an enumerated type be able to have as an
  327. element any string comprised of characters in the standard character
  328. set.
  329.  
  330.     Our remaining recommendations concern support tools and structures.
  331. We recognize that activity is already on-going in several areas which we
  332. mention below. We wish to take this opportunity to state for the record
  333. our support of such activities in the hope that the government will
  334. continue to sponsor the development of integrated environments which
  335. will significantly promote programmer efficiency.
  336.  
  337.     * Large scale APSEs are desperately needed. They should include
  338.       those elements specifically mentioned in Stoneman. In addition,
  339.       we need to make a wide variety of special purpose tools available.
  340.       Examples include:
  341.  
  342.          a) a routine which determines compilation order dependencies
  343.             between a large number of packages
  344.  
  345.          b) a scope evaluator which would create a comment block at the
  346.             beginning of a package defining the types, variables, and
  347.             procedures made available by the various 'with' clauses.
  348.  
  349.          c) a pretty printer to generate code in the format discussed
  350.             in the next bullet
  351.  
  352.     * There should exist, as a MIL-SPEC an Ada programming style guide
  353.       providing requirements for indentation, comment placement, banner
  354.       style, naming conventions, and so on. Pretty printers should be
  355.       available which reformat source files into the SPEC format, and
  356.       a validator should be available to determine whether a source
  357.       file does in fact meet the SPEC.
  358.  
  359.     * While the idea has some legal ramifications, we would like to see
  360.       some sort of institutional, independent baseline parameter
  361.       measurements for Ada implementations. Certainly DOD might be in a
  362.       position to issue descriptions of compilers and tools which are
  363.       validated for use in DOD applications. Such data could include a
  364.       profile of measures of performance (MOPs) in each of a number of
  365.       critical areas.
  366.  
  367.     * An Ada library should be aggressively implemented. It should be
  368.       well publicized and easy to use. Access to it should be part and
  369.       parcel to every Ada-related development contract. (e.g. a first
  370.       deliverable, informal 30 DAC wherein the contractor describes the
  371.       results of his library search to find elements of use in the
  372.       subject development - kind of a hard-ass approach, but at first,
  373.       it might be what it takes)
  374.  
  375.  
  376. 3.2 GMHF Specific Recommendations.
  377.  
  378.     The GMHF is complete and useable as is. However, it can certainly be
  379. improved. There are three areas in which continued work should be done.
  380. First, the kludges required by the state of the Telesoft compiler should
  381. be removed. Second, the user entry of data during message construction
  382. should be improved. Finally, research in the use of more sophisticated
  383. data structures to define message components, and possibly messages
  384. themselves, should be continued.
  385.  
  386. 3.2.1 Clean-up of Existing Code.
  387.  
  388.     The existing functions should be restructured within the structure
  389. of the original design to improve portability and maintainability. GMHF
  390. has the potential to be widely used, both on its own merits, and as a
  391. point-of-departure for future message handlers. While its existing
  392. structure is well documented, the various kludges described elsewhere
  393. result in inconsistancies and a structure which is not as simple and
  394. straightforward as it should be. The cost of the current less than
  395. optimal structure to future implementors is difficult to estimate, but
  396. is certainly non-trivial. The time required to come up to speed is
  397. increased, the time required to make modifications is increased, and the
  398. risk of injecting errors is increased. These negative factors can be
  399. minimized by putting the code in a more logical architecture. Also, it
  400. is difficult and somewhat unrealistic to measure parameters of any
  401. system when that system's implementation has been negatively impacted
  402. by environmental factors. As Ada comes into more general use, the
  403. generation of baselines and the measurement of performance will be ever
  404. more important.
  405.  
  406.     We suggest that design compromises described here and in the Users/
  407. Implementors Manual be remedied. The original architecture should be
  408. implementable on compilers now available. One assumes that these
  409. compilers would not themselves require other kludges, but that would
  410. depend on the particular compiler made available. Specific change areas
  411. suggested include reducing the number of packages and increasing the
  412. scope of the generic definition. These changes are covered in more
  413. detail in the Users Manual.
  414.  
  415. 3.2.2 Enhanced User Data Entry.
  416.  
  417.      The existing system validates all user data entry through the use
  418. of Ada data definitions and built-in validation features. However, the
  419. user is required to enter the data, character at a time. For freeform
  420. fields, there is no alternative, but most fields in message standards
  421. at which GMHF is targeted are defined to contain one of several specific
  422. data entries. To facilitate data entry for such fields, we suggest that
  423. two additional approaches be integrated into GMHF. Implementors would
  424. then be able to define a field to have its data entered in any of the
  425. three ways.
  426.  
  427.      The two suggested additional methods of data entry are list fields
  428. and abbreviated entry. There are cases in which either has advantages.
  429. A list field is a screen area in which one of the allowable data choices
  430. for a particular field is displayed. When the field is active, the
  431. up/down arrows allow the user to scroll legal choices through the field.
  432. When the desired choice is displayed in the field, the user simply moves
  433. on to the next field. On most terminals, this type of data entry is
  434. completed entirely through the use of the arrow keys. It is extremely
  435. popular with users when the number of allowable choices is fairly small,
  436. say 10 or less items.
  437.  
  438.      When the number of list items is large, the method of abbreviated
  439. data entry is preferable. Using this method, the user need enter only
  440. enough characters to uniquely identify the desired data item. This
  441. might be the entire item, but in practice is usually much less, often
  442. only a single character.
  443.  
  444.      There are existing implementations of list fields in Fortran, and
  445. we know of an implementation of abbreviated data entry in Ada which can
  446. probably be used to support GMHF enhancement. In integrating these data
  447. entry methods into GMHF, we would also enhance the user prompt handler
  448. to allow the implementor to handle full screen and even multi-screen
  449. prompts.
  450.  
  451. 3.2.3 Message Data Structure Enhancements.
  452.  
  453.     Part of the purpose of the GMHF development was to gain practical
  454. experience in how well Ada handles complex data structures. This goal
  455. was partially met. A number of complex data structures are defined and
  456. implemented in GMHF, and Ada is found to handle them effectively.
  457. However, we had hoped to go even further than we did, and to define a
  458. message as a single entity. We were not able to implement this due to
  459. the compiler version available early in the effort. By the time a later
  460. version was available which supported the required constructs, our
  461. design was complete and there was not time to step back and redesign
  462. the system. With the initial version of GMHF complete and in use, it
  463. would be of interest to continue research in this area.
  464.  
  465.     Essentially, what we propose to do is to change the way GMHF
  466. internally handles message data. At present, a message is a linked
  467. list of lines, each line being a string. Data are entered through
  468. the use of data structures, and then converted to strings for storage
  469. using built-in features of the language. We would like to deal with
  470. messages as arrays of lines of variant type. We would then define a
  471. line as an array of fields of variant type. Fields would be defined
  472. to be data elements, similar to the way they are currently defined.
  473. Aside from the obvious advantages of eliminating conversions, this
  474. structure would, we think, facilitate the validation and handling of
  475. messages, as entities, by software which would receive and/or transmit
  476. the message. If we are correct, this would be a significant enhancement.
  477. If we are not, perhaps in finding out why we will uncover alternative
  478. approaches.
  479.  
  480.     Veda stands ready to continue GMHF research and development should
  481. the government choose to support such an effort.
  482.  
  483. ------
  484.  
  485.