comp.lang.ada
 help / color / mirror / Atom feed
From: Wesley Groleau <wesgroleau@despammed.com>
Subject: Re: Case dependence and coding standards
Date: Thu, 05 Jun 2003 13:32:05 -0500
Date: 2003-06-05T13:32:05-05:00	[thread overview]
Message-ID: <5Uudnc0G7djTEEKjXTWcqQ@gbronline.com> (raw)
In-Reply-To: <bbnbff$1hq$1@a1-hrz.uni-duisburg.de>


> Still quickly finding just the modes might be useful in _some_ cases,
> but then I'd prefer what is frequently done in print: make
> them stand out using bold face type. As you have demonstrated,

Yes, that helps, too.

> humans can easily find out whether something is tabular in nature
> _without_ "squarish" tabular layout, if "abstract" column separators
> can easily be seen, like a ':'.

But they can do it with less mental energy if it is "squarish"
> particulars are important, but how about variable declarations,
> consisting of name, type, constraints, and comment?  How about
> constants, which add another column? Should a constraint that
> might have three parts trigger tabular layout? Say you have

Indeed, the more parts you have and the longer the names of the parts,
the harder it is to keep line length reasonable.  I generally consider
various options to get the layout that I feel is the least work for
an unfamilar person to understand.  It is subjective, but I think
my intuition is influenced by the empirical studies I've read on
readability and human factors, as well as by the numerous
misunderstandings I've witnessed people making on poorly formatted
code and technical prose, not only in software work, but in teaching
math, language, and electronics, and in reading and writing technical
material myself.

>       station_latitude: constant Mammoth_Footstep := 12;  -- where we are
>  
> If these four declarations should be grouped and alignments made at
> ':' etc, there will be a problem. 

Yes.  Sometimes you have to take another approach, as I've said above.
For this one (depending on what else is nearby), I'd probably put
separate it from the others with a blank line and format it differently.

> 
> After all I could argue that an if statement is a table in
> nature too, like a case statement. Column borders: if, then, else, end.
> Still, what kind of tabular layout is appropriate for an if statement?

Sure, but hardly ever are any of the parts short enough
to put side by side on a single line AND adjacent to another
such 'if' statement to make it worthwhile.

> Interestingly, it might be different with case statements where the cases
> are short. But would you favour the use of "=>" after "when X"
> as a column separator in the same way as ':' in variable declarations?

Yes, IF short enough.  This also is rare.  But when
it does happen, I do prefer one of the styles you offered:

>       case X is
>          when 1      => letsgo;
>          when 2 .. 4 => come_on;
>          when 5      => go_steady;
>          when 6 | 7  => calm;
>       end case;

> : Notice that I never intended screwing up the comments as your
> : strawman suggests.
> 
> It was not my intention to suggest that you screw up comments.

But your counterexample was prose such as would only occur
in comments.  Sorry if I misunderstood your intent.




  parent reply	other threads:[~2003-06-05 18:32 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-03  5:05 Case dependence and coding standards Fionn mac Cuimhaill
2003-06-03 17:31 ` Robert A Duff
2003-06-03 17:46   ` Vinzent Hoefler
2003-06-03 19:04     ` Robert A Duff
2003-06-03 23:37       ` Randy Brukardt
2003-06-04  2:39         ` Wesley Groleau
2003-06-04 13:28           ` Georg Bauhaus
2003-06-04 15:44             ` Preben Randhol
2003-06-04 22:32             ` Wesley Groleau
2003-06-05 12:01               ` Georg Bauhaus
2003-06-05 15:36                 ` Preben Randhol
2003-06-05 17:41                   ` Wesley Groleau
2003-06-05 17:47                     ` Preben Randhol
2003-06-05 17:51                       ` Preben Randhol
2003-06-05 18:32                 ` Wesley Groleau [this message]
2003-06-06  8:58                   ` Georg Bauhaus
2003-06-07  0:53                     ` Wesley Groleau
2003-06-10 15:05                       ` Georg Bauhaus
2003-06-05 17:32               ` Wesley Groleau
2003-06-05 17:43                 ` Preben Randhol
2003-06-04  8:39       ` Vinzent Hoefler
2003-06-04 16:32         ` Stephen Leake
2003-06-05  1:27           ` Robert I. Eachus
2003-06-05  7:47           ` Vinzent Hoefler
2003-06-05 17:47             ` Stephen Leake
2003-06-05 19:43               ` Wesley Groleau
2003-06-06  9:27               ` Georg Bauhaus
2003-06-06 10:29                 ` Preben Randhol
2003-06-03 19:38   ` Stephen Leake
  -- strict thread matches above, loose matches on Subject: below --
2003-06-04 17:00 Lionel.DRAGHI
replies disabled

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