home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / ada / 3678 < prev    next >
Encoding:
Internet Message Format  |  1992-12-14  |  2.1 KB

  1. Path: sparky!uunet!spool.mu.edu!agate!dog.ee.lbl.gov!news!nosc!visicom!rlk
  2. From: rlk@VisiCom.COM (Bob Kitzberger)
  3. Newsgroups: comp.lang.ada
  4. Subject: Language pitfalls (was Re: FORTRAN bug)
  5. Message-ID: <252@visicom.com>
  6. Date: 14 Dec 92 21:57:23 GMT
  7. References: <EACHUS.92Dec7184734@oddjob.mitre.org> <1992Dec8.072300.21473@smds.com> <1992Dec8.172551.16780@newshost.lanl.gov> <1992Dec9.060218.23940@seas.gwu.edu> <1992Dec11.132942.24054@mksol.dseg.ti.com> <1992Dec11.163811@lglsun.epfl.ch> <1992Dec14.165537.18275@mks
  8. Sender: news@VisiCom.COM
  9. Lines: 33
  10.  
  11. Experienced C programmers have rules of thumb that they follow in order
  12. to help them to avoid language "problems".  Ada programmers also have
  13. rules of thumb to help them avoid language "problems".  If you were to
  14. list the top five C rules of thumb, they'd be something like:
  15.  
  16.     1. Use conditional preprocessor directives in .h files to avoid
  17.            multiple file inclusions (oops!  That's a C preprocessor rule ;-)
  18.      2. Always use curly braces in conditionals
  19.     3. Be careful to use '==' when you mean it, instead of '='
  20.     4. Always malloc one more byte then your array length for strings
  21.     5. Always use 'break' in each switch case, unless you really mean it
  22.  
  23. The top five rules of thumb for Ada are probably something like:
  24.  
  25.     1. Don't get carried away using tasks as units of decomposition
  26.     2. Don't use the predefined types; define your own types
  27.     3. Use packages as units of decomposition.
  28.     4. Use private types to hide implementation details
  29.     5. Avoid the USE clause; consider RENAMES instead.
  30.  
  31. Note that the Ada rules of thumb are more geared towards programming
  32. in the large, and reflect the fact that the Ada programmer spends less
  33. time on annoying *run-time* syntax glitches (*), and more time on
  34. encapsulation and decomposition issues.
  35.  
  36.     .Bob.
  37.  
  38. (*) Of course, Ada programmers spend more time with compile-time syntax
  39.     errors than anyone else ;-)
  40. ----------------
  41. Bob Kitzberger          VisiCom Laboratories, Inc.
  42. rlk@visicom.com         10052 Mesa Ridge Court, San Diego CA 92121 USA
  43.                         +1 619 457 2111    FAX +1 619 457 0888
  44.