comp.lang.ada
 help / color / mirror / Atom feed
From: rlk@rational.com (Bob Kitzberger)
Subject: Re: Just a question...
Date: 1996/04/17
Date: 1996-04-17T00:00:00+00:00	[thread overview]
Message-ID: <4l3cbg$j24@rational.rational.com> (raw)
In-Reply-To: 4l32nn$mqn@boson.epita.fr

: " What are the 3 or 4 advices you would tell to a C programmer who
:   wants to use Ada ?"

- When defining types, learn to think in terms of the problem domain
  (range, precision, enumeration, etc.) rather than the predefined
  types (integer, character, etc.).  Try to avoid using predefined
  types directly; define new types that match the problem domain

- Forget about the preprocessor, at least initially.  Think of
  alternate ways to solve the problem that you are used to using
  the preprocessor for (Ada has idioms to handle almost every
  macro processor usage)

- Start thinking in terms of the contract model of programming,
  i.e. Ada's separation of specification and implementation (body).
  In C at it's best, a header file is equivalent to the specification,
  and the .c file is equivalent to the body (I _rarely_ see C code
  with that high level of quality!)

- Use the contract model to hide implementation details: avoid placing
  type definitions in package specifications (at least for ADTs)
  instead use private types to defer implementation details to the
  body.
  
- Do _not_ use the USE clause until you feel comfortable knowing
  when it's appropriate.

These are not intended to ease the transition -- but rather help you
learn to program in Ada the way I like it ;-)  If you try to program
"C in Ada" you will be frustrated, but if you learn the idioms
things will be much easier... (holds true for any language, IMHO).

--
Bob Kitzberger	      Rational Software Corporation       rlk@rational.com




  reply	other threads:[~1996-04-17  0:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-04-17  0:00 Just a question patrick lacheny
1996-04-17  0:00 ` Bob Kitzberger [this message]
1996-04-17  0:00 ` Ian Ward
1996-04-17  0:00 ` Carl Bowman
1996-04-17  0:00   ` Michael F Brenner
1996-04-29  0:00 ` Roga Danar
1996-04-30  0:00   ` Greg Bond
1996-04-30  0:00   ` Philip Brashear
1996-04-30  0:00   ` Robert Dewar
  -- strict thread matches above, loose matches on Subject: below --
1996-04-18  0:00 just " W. Wesley Groleau (Wes)
1996-04-22  0:00 ` Nasser Abbasi
1996-04-23  0:00 Just " W. Wesley Groleau (Wes)
replies disabled

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