Liste des Groupes | Revenir à cl c |
On 26/02/2025 18:13, Janis Papanagnou wrote:On 26.02.2025 17:32, David Brown wrote:On 26/02/2025 15:39, Bradley K. Sherman wrote:>Just do your best to keep it neat and under 80 columns.>
>
Neat, yes. 80 columns, no - unless you are living in the previous
century.
That's the typical response of someone who obviously doesn't care. :-/
>
I care about legibility of code, and convenience of working with it. I
don't care how well it fits in a text-only screen that is limited by
ancient hardware.
I do plenty from the command-line, but if I am
working with a file from the command line, it is almost invariably under
a gui - terminal windows can be sized for convenience.
[...]>
This sounds more reasonable. :-)
>
[...]
Too long lines are hard to read. Too short lines are hard to read.
80 columns is not a terrible choice, but it is too often too short,
especially if you try to view it as a hard limit.
[...]
Too short identifiers are bad - too long identifiers are bad.
Generally, identifier length should be roughly related to the size of
their scope.
From typesetting we know that long lines are bad to read; why are
the newspaper columns so narrow?
Newspaper columns are hard to read well - they are narrow because
newspapers are often trying to put a lot of stuff on one page despite it
being less legible.
The "ideal" length for prose will vary depending on the kind of text,
the language, the size and style of the font, the general layout, the
medium, and other factors.
Somewhere between about 60 and 100 characters is typical.
Long lines are even worse to read if you use sans-serif fonts;
too bad that such bad fonts are dominating our modern world, and
especially in the IT ("thanks" MS for fostering Arial, etc.);
using less columns is also often advantageous here to compensate
the reduced legibility.
Don't expect that everyone has a screen as big as yours; that is
the case in companies but also in other places or projects where
code is shared or where people work together.
>
Shorter line lengths don't make it easier to work on smaller screens. A
smaller screen means less code is visible at a time, regardless of line
length.
Myself I have the habit to take an 80 column screen as baseline,
organize my source code in that frame. But that's no credo; the
purpose is just to not let the lines get too long "by accident".
I then wrap the code at sensible places with indentation. And if
_some_ lines get longer, say your 100 or 120 columns, that's no
problem as long as the overall readability is still guaranteed.
>
Again, preferences vary, here as well.
>
Sure. I am simply arguing against hard and fast rules that are not
based on hard and fast reality.
Les messages affichés proviennent d'usenet.