tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Rationale for some rules in style guide
On Wed, Apr 12, 2023 at 07:53:23 +0930, Brett Lymn wrote:
> > > then in alphabetical order
> >
> > Why does it make sense to sort variables in the order 'bottom, left,
> > right, top' instead of the natural pronunciation order 'top, left,
> > bottom, right', for example? Or 'height, width, x, y' instead of 'x, y,
> > width, height'?
> >
>
> More of a readability thing I think - if the variable names are sorted
> and you are looking for "indicator" then you can stop after "height".
> You can be confident you have not missed the variable in the noise.
That might have been a concern when all variable definitions had to be
at the beginning of a block and when you were more likely to read
program listings printed out on paper :) This is probably less
relevant now.
(Also, for the example you give one had to know that "indicator" is the
same type - or at least the same size as "height" :).
-uwe
Home |
Main Index |
Thread Index |
Old Index