comp.lang.ada
 help / color / mirror / Atom feed
From: "Eric S. Sessoms" <sesse@ruby.ils.unc.edu>
Subject: Re: Easily-Read C++?
Date: Wed, 5 Oct 1994 10:26:24 -0400 (EDT)
Date: 1994-10-05T10:26:24-04:00	[thread overview]
Message-ID: <Pine.ULT.3.90.941005075408.27222A-100000-100000-100000@ruby.ils.unc.edu> (raw)
In-Reply-To: <941005030023_73672.2025_DHR103-1@CompuServe.COM>



On Tue, 4 Oct 1994, Ken Garlington wrote:

> Robin Rowe <cpp@NETCOM.COM> writes:
> 
> << Here's how I read a piece of C++ code:
> 
>     if(!object)                  // "If not object [then]"
>     {   cerr<<object.ErrorMsg(); // "output object's error
>     }                            //  message,"
>     else                         // "else"
>     {   object++;                // "increment object."
>     }
> 
> So what's unnatural about this? Sounds like English to me. >>

I've been giving a lot of thought to this readability issue, since
as a native C/C++ speaker, I find the readability of Ada to be one
of its strong points.  BUT, the factors I find contribute most to
the readability of Ada do not include its "englishness".  Rather, some
of the language features such as subrange types, arbitrarily bounded
arrays, and arrays over enumerated or character types seem (to me) to
make the greatest contribution.  (And nested procedure declarations,
can't forget that!)

Now, as Robin Rowe pointed out, these are not foreign concepts
in C++.  In fact, they are all rather trivial given the wonderful
C++ template mechanism, but that's where they fall.  *The necessary
templates are not standard.*

By taking these low level concepts as part of the language, Ada has
standardized a much larger part of what (some) programmers (like me)
do.  The net effect is that in moving from one person's code to another
(or one shop's code to another, if they impose shop standards) there
is a slight decrease in reading effort from not having to re-learn
how Coder X has chosen to implement a few necessary low-level concepts.

just to throw in some pseudo-code:
  enum days_of_week { sunday, monday, tuesday, wednesday, ..., saturday };
  typedef Bounded<days_of_week, monday, friday> week_days;
  Array<week_days, int> beers_drank;
  beers_drank[wednesday] = 0;

Having only one integer type is also nice.  Why, nearly as nice
as "class Integer {...};"!  Do you see my point?  I really doubt
there is much in Ada that you can't have in C++, but in Ada it
is (1) easier and (2) standardized -- so convince me that standardization
gives you something more than a larger language standard.

IMHO, it helps _a_lot_.  IMHO, it will all be moot once standardized
C++ class libraries become commonly available.

Responses?  Ideas?  Criticisms?  I'm very tired of "'begin end' is better
than '{ }'" arguments, and the "Ada programmers use longer names"
arguments, but I would be very interested in any further discussion of
what language elements contribute either to the readability of Ada or of
C++.  Please post follow-ups here and direct all flames to: 

	eric sessoms (sesse@ruby.ils.unc.edu)




  parent reply	other threads:[~1994-10-05 14:26 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1994-10-05  3:00 Easily-Read C++? Ken Garlington
1994-10-05  9:42 ` Pierre Castori
1994-10-05 13:28   ` Robert Dewar
1994-10-06  2:20     ` Benjamin Ketcham
     [not found]     ` <CxDL8H.KGE@csn.org>
     [not found]       ` <milodCxH2E4.7F4@netcom.com>
     [not found]         ` <CxHJv0.Kw0@csn.org>
     [not found]           ` <DAG.94Oct11080229@bellman.control.lth.se>
     [not found]             ` <37du0k$ir2@gnat.cs.nyu.edu>
1994-10-12  3:19               ` Attractive comments better? R_Tim_Coslet
1994-10-13  1:35               ` Michael Feldman
1994-10-12 17:03           ` Easily-Read C++? John DiCamillo
1994-10-05 14:26 ` Eric S. Sessoms [this message]
1994-10-05 17:47 ` Kevin Cline
1994-10-05 22:02   ` Robert Dewar
1994-10-05 22:23     ` Richard Kenner
     [not found]       ` <124377@cup.portal.com>
1994-10-11 18:11         ` David Weller
1994-10-11 18:43         ` Robert Dewar
1994-10-12 13:15           ` Norman H. Cohen
1994-10-12 14:10             ` Robert Firth
1994-10-13 19:33             ` John D. Reading
1994-10-13  0:51         ` Keith Thompson @pulsar
1994-10-05 18:24 ` Magnus Kempe
     [not found] ` <EACHUS.94Oct6101347@spectre.mitre.org>
     [not found]   ` <371a3p$nos@gnat.cs.nyu.edu>
     [not found]     ` <1994Oct7.153254.29848@swlvx2.msd.ray.com>
     [not found]       ` <374uke$8mo@delphi.cs.ucla.edu>
     [not found]         ` <37bno4$ko4@gnat.cs.nyu.edu>
1994-10-11 13:00           ` Robert Firth
1994-10-11 13:44             ` Casper H.S. Dik
1994-10-11 19:03               ` Robert Dewar
1994-10-12 16:38               ` John DiCamillo
1994-10-11 18:52             ` Robert Dewar
1994-10-12 13:49               ` Norman H. Cohen
     [not found]           ` <37eej8$6ie@siberia.gatech.edu>
1994-10-11 18:55             ` Robert Dewar
1994-10-12 13:35               ` John M. Mills
1994-10-12 19:48                 ` Robert Dewar
     [not found]         ` <CxFr5B.K1G@news.otago.ac.nz>
     [not found]           ` <DAG.94Oct10075533@bellman.control.lth.se>
1994-10-11 17:50             ` Norman H. Cohen
     [not found]     ` <373vd2$39n@theopolis.orl.mmc.com>
     [not found]       ` <CxBvq7.GrH@inmet.camb.inmet.com>
     [not found]         ` <37bnic$kj2@gnat.cs.nyu.edu>
1994-10-11 18:02           ` Norman H. Cohen
     [not found] ` <1994Oct7.110309@di.epfl.ch>
     [not found]   ` <DAG.94Oct7204142@bellman.control.lth.se>
     [not found]     ` <1994Oct7.210111.4494@nosc.mil>
     [not found]       ` <374i3o$c87@Starbase.NeoSoft.COM>
1994-10-12 17:37         ` "Tag" (Was: Easily-Read C++? (NOT)) David Emery
     [not found] <3719k1$11gt@watnews1.watson.ibm.com>
     [not found] ` <85C92963672@annwfn.com>
1994-10-11 18:37   ` Easily-Read C++? Norman H. Cohen
1994-10-12 16:54     ` David Emery
1994-10-14 21:13       ` Kevin Cline
1994-10-21 14:38         ` Thomas M. Breuel
1994-10-22  3:10           ` Michael M. Bishop
1994-10-26  0:39             ` -mlc-+Schilling J.
1994-10-27 14:54               ` Bob Duff
1994-10-27 15:35                 ` Richard Kenner
1994-10-27 23:09                 ` Robert Dewar
1994-11-01 21:19                 ` Adam Beneschan
1994-11-02  0:46                   ` Bob Duff
  -- strict thread matches above, loose matches on Subject: below --
1994-10-12  3:06 Easily-Read C++ Ken Garlington
1994-10-14 10:50 Easily-Read C++? Bob Wells #402
replies disabled

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