Re: derangement: code review request
From: Richard Bos (rlb_at_hoekstra-uitgeverij.nl)
Date: 10/28/04
- Next message: Ben: "Re: Linked List problem."
- Previous message: Richard Bos: "Re: Pointer Guide Nearing Completion"
- In reply to: Tim Rentsch: "Re: derangement: code review request"
- Next in thread: Tim Rentsch: "Re: derangement: code review request"
- Reply: Tim Rentsch: "Re: derangement: code review request"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Next message: Ben: "Re: Linked List problem."
- Previous message: Richard Bos: "Re: Pointer Guide Nearing Completion"
- In reply to: Tim Rentsch: "Re: derangement: code review request"
- Next in thread: Tim Rentsch: "Re: derangement: code review request"
- Reply: Tim Rentsch: "Re: derangement: code review request"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|