comp.lang.ada
 help / color / mirror / Atom feed
From: visicom!rlk@nosc.mil  (Bob Kitzberger)
Subject: Language pitfalls (was Re: FORTRAN bug)
Date: 14 Dec 92 21:57:23 GMT	[thread overview]
Message-ID: <252@visicom.com> (raw)

Experienced C programmers have rules of thumb that they follow in order
to help them to avoid language "problems".  Ada programmers also have
rules of thumb to help them avoid language "problems".  If you were to
list the top five C rules of thumb, they'd be something like:

	1. Use conditional preprocessor directives in .h files to avoid
           multiple file inclusions (oops!  That's a C preprocessor rule ;-)
 	2. Always use curly braces in conditionals
	3. Be careful to use '==' when you mean it, instead of '='
	4. Always malloc one more byte then your array length for strings
	5. Always use 'break' in each switch case, unless you really mean it

The top five rules of thumb for Ada are probably something like:

	1. Don't get carried away using tasks as units of decomposition
	2. Don't use the predefined types; define your own types
	3. Use packages as units of decomposition.
	4. Use private types to hide implementation details
	5. Avoid the USE clause; consider RENAMES instead.

Note that the Ada rules of thumb are more geared towards programming
in the large, and reflect the fact that the Ada programmer spends less
time on annoying *run-time* syntax glitches (*), and more time on
encapsulation and decomposition issues.

	.Bob.

(*) Of course, Ada programmers spend more time with compile-time syntax
    errors than anyone else ;-)
----------------
Bob Kitzberger          VisiCom Laboratories, Inc.
rlk@visicom.com         10052 Mesa Ridge Court, San Diego CA 92121 USA
                        +1 619 457 2111    FAX +1 619 457 0888

             reply	other threads:[~1992-12-14 21:57 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1992-12-14 21:57 Bob Kitzberger [this message]
  -- strict thread matches above, loose matches on Subject: below --
1992-12-15 13:55 Language pitfalls (was Re: FORTRAN bug) enterpoop.mit.edu!eru.mt.luth.se!lunic!sunic!news.lth.se!dag
1992-12-15 14:55 David Emery
1992-12-15 15:47 Michael Feldman
1992-12-15 18:08 Richard Pattis
1992-12-15 20:35 news.centerline.com!noc.near.net!inmet!spock!stt
1992-12-16  1:22 Robert I. Eachus
1992-12-16 14:38 crispen
1992-12-16 16:32 olivea!spool.mu.edu!yale.edu!qt.cs.utexas.edu!cs.utexas.edu!asuvax!ennews
1992-12-16 17:27 Mark A Biggar
1992-12-16 17:38 Bob Kitzberger
1992-12-16 20:02 Julian C . Lander
1992-12-16 20:59 John Bollenbacher
1992-12-17  1:31 Robert I. Eachus
1992-12-17 14:18 Terry J. Westley
1992-12-17 18:48 John Halper
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox