Re: derangement: code review request

From: Richard Bos (rlb_at_hoekstra-uitgeverij.nl)
Date: 10/28/04


Date: Thu, 28 Oct 2004 13:35:46 GMT

Tim Rentsch <txr@alumnus.caltech.edu> wrote:

> rlb@hoekstra-uitgeverij.nl (Richard Bos) writes:
>
> > Tim Rentsch <txr@alumnus.caltech.edu> wrote:
> >
> > > A couple of the names use abbreviations as part of the name (eg,
> > > 'fam_size'). I recommend using the whole word, and always avoiding
> > > abbreviations.
> >
> > I disagree. Even for normal abbreviations, not just for acronyms,
> > industry-standard abbrevs are probably more legible than the whole word.
> >
> > I mean, my main program deals with entering data for advertisement. Can
> > you imagine how much larger and less legible my code would've been if
> > I'd used advertisement_width_in_columns everywhere I know have adv_cols?
>
> How about 'ad_columns'? My unabridged dictionary includes 'ad' as a
> word. If 'ad_columns' is still too long for you, 'ad_width' has the
> same number of letters as 'adv_cols'.

Whatever. It's still an abbreviation, and avoiding abbreviations would
have been counterproductive, in this case.

> > > void
> >
> > Ew, ganoo style.
>
> It's hard to know how to respond to a statement that is clearly
> nothing more than name calling. If you have a comment about the usage
> rather than just an objection to some people who happen to use it, how
> about letting us know what that is?

It's ugly. It splits the type of the function over two lines for no good
reason (antediluvian editors are no excuse), and separates the return
type from the identifier in a way that nobody would even consider using
for objects. You don't write

  int
  i, j, counter;

do you? Well, then, why do so for functions?

> > > generate_random_derangement( unsigned a[], unsigned n ){
> > > unsigned i, j, t, r, r_limit;
> > >
> > > r_limit = RAND_MAX - RAND_MAX % n;
> > >
> > > for( i = 0; i < n; i++ ) a[i] = i;
> >
> > Ew ew ew! You just proved that whitespace isn't _always_ good (and
> > whitespace on the _inside_ or parens rarely is).
>
> If indeed something has been proved here, a better candidate is that
> the spacing style used above is something Richard Bos is unaccustomed
> to seeing.

Thankfully, yes. It's been quite well proven (for centuries; spacing is
not something that is unique to source code) that both too few, but also
too much whitespace renders text less legible.
Y o u d o n o t w r i t e like t h i s ,d o y o u ?

Richard



Relevant Pages

  • Re: derangement: code review request
    ... Even for normal abbreviations, not just for acronyms, ... the spacing style used above is something Richard Bos is unaccustomed ... The spacing style exemplified in the 'for' statement above arises ... the first time I ate sushi I didn't like it either. ...
    (comp.lang.c)
  • Re: derangement: code review request
    ... It's still an abbreviation, and avoiding abbreviations would ... Or are you saying you've considered all possible reasons ... >> the spacing style used above is something Richard Bos is unaccustomed ... Weak because the spacing in the prose text example is ...
    (comp.lang.c)