Re: Which code style do you prefer the most?

Liste des GroupesRevenir à cl c 
Sujet : Re: Which code style do you prefer the most?
De : janis_papanagnou+ng (at) *nospam* hotmail.com (Janis Papanagnou)
Groupes : comp.lang.c
Date : 27. Feb 2025, 06:57:10
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vpourn$30a9h$1@dont-email.me>
References : 1 2 3 4 5 6 7 8
User-Agent : Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0
On 26.02.2025 20:56, David Brown wrote:
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.

Wherever and whenever it originated is not the question. - Here I was
just pointing out that "living in the previous century" is a typical
response of someone who obviously isn't much interested in rationales
and in discussions of these. We've heard that regularly, just recently
for example in context of "ancient editors". If there were interest we
would discuss it differently.

So lets see what follows... :-)

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.

Yes, I agree.

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.

Since decades now there are no such hard limits, so why do you make
up such a statement.

 [...]
 
Too short identifiers are bad - too long identifiers are bad.

Yes, as a rule of thumb, I agree.

Though it doesn't hold as sort of a general truth, because...

 
Generally, identifier length should be roughly related to the size of
their scope.

...of that. - I agree.

 
 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.

I take this as your opinion.

In newspapers you can find articles that can span even a whole page.
It's nonetheless organized in small columns.

 
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.

Right.

Somewhere between about 60 and 100 characters is typical.

These numbers appear strange to me. - A quick look into a couple of
different editions show more like 45-90 characters, with typical
values around 55-70 (including spaces counted as characters), i.e.
not in the extreme ranges. For these numbers I've inspected random
books written in different layouts, in three different languages,
and of different types. - I would be very astonished if that would
be fundamentally different in your language domain, but YMMV.

So I have to conclude that printed typical text would fit regularly
and easily in an 80 column mono-spaced medium.

 
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.

It's not about "small screens"; it's about readability as being a
function of the used line-length. But readability, while probably
a most important factor, is not the only aspect...

Myself I usually operate on a minimum of two physical screens, and
(with my font setting) each one capable of displaying two 80-column
windows side by side. I regularly work with more than one text file
in parallel, and if there's some source with significantly larger
line width I either have to scroll sidewards of have to accept line
wraps at arbitrary (typically very bad) places with all the negative
effects! It's much better to define the code layout yourself, better
for legibility in the first place, and better to work with available
typical resources.

 
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.

There was no hard rule as should have been obvious by what I wrote.

The 80 column rule [of thumb] is a good (empirical) base; while it
may have had its origin in historic hard limits of IT devices (like
VT100 or some such - that, BTW, are also not completely arbitrarily
chosen!) it is also a _sensible value_ given the expertise of the
printed media, and the reality of work (in the IT sector or else).

YMMV.

Janis


Date Sujet#  Auteur
25 Feb 25 * Which code style do you prefer the most?272Ar Rakin
25 Feb 25 +* Re: Which code style do you prefer the most?108David LaRue
25 Feb 25 i`* Re: Which code style do you prefer the most?107Ar Rakin
25 Feb 25 i +* Re: Which code style do you prefer the most?104David Brown
25 Feb 25 i i+* Re: Which code style do you prefer the most?102Ar Rakin
25 Feb 25 i ii`* Re: Which code style do you prefer the most?101David Brown
25 Feb 25 i ii +* Re: Which code style do you prefer the most?3Janis Papanagnou
26 Feb 25 i ii i`* Re: Which code style do you prefer the most?2David Brown
26 Feb 25 i ii i `- Re: Which code style do you prefer the most?1Janis Papanagnou
26 Feb 25 i ii `* Re: Which code style do you prefer the most?97Ar Rakin
26 Feb 25 i ii  +* Re: Which code style do you prefer the most?4Janis Papanagnou
27 Feb 25 i ii  i`* Re: Which code style do you prefer the most?3Lawrence D'Oliveiro
27 Feb 25 i ii  i +- Re: Which code style do you prefer the most?1Janis Papanagnou
27 Feb 25 i ii  i `- Re: Which code style do you prefer the most?1Ar Rakin
26 Feb 25 i ii  `* Re: Which code style do you prefer the most?92David Brown
26 Feb 25 i ii   `* Re: Which code style do you prefer the most?91Bradley K. Sherman
26 Feb 25 i ii    +* Re: Which code style do you prefer the most?48David Brown
26 Feb 25 i ii    i+* Re: Which code style do you prefer the most?41Janis Papanagnou
26 Feb 25 i ii    ii`* Re: Which code style do you prefer the most?40David Brown
27 Feb 25 i ii    ii `* Re: Which code style do you prefer the most?39Janis Papanagnou
27 Feb 25 i ii    ii  `* Re: Which code style do you prefer the most?38David Brown
28 Feb 25 i ii    ii   +* Re: Which code style do you prefer the most?25Richard Harnden
28 Feb 25 i ii    ii   i`* Re: Which code style do you prefer the most?24Michael S
28 Feb 25 i ii    ii   i +- Re: Which code style do you prefer the most?1Lawrence D'Oliveiro
2 Mar 25 i ii    ii   i `* Re: Which code style do you prefer the most?22Tim Rentsch
3 Mar 25 i ii    ii   i  +* Re: Which code style do you prefer the most?6Michael S
3 Mar 25 i ii    ii   i  i+* Re: Which code style do you prefer the most?4bart
3 Mar 25 i ii    ii   i  ii+* Re: Which code style do you prefer the most?2Richard Harnden
3 Mar 25 i ii    ii   i  iii`- Re: Which code style do you prefer the most?1bart
4 Mar 25 i ii    ii   i  ii`- Re: Which code style do you prefer the most?1Lawrence D'Oliveiro
3 Mar 25 i ii    ii   i  i`- Re: Which code style do you prefer the most?1Tim Rentsch
3 Mar 25 i ii    ii   i  +- Re: Which code style do you prefer the most?1Tim Rentsch
4 Mar 25 i ii    ii   i  `* Re: Which code style do you prefer the most?14Keith Thompson
4 Mar 25 i ii    ii   i   +* Re: Which code style do you prefer the most?7Lawrence D'Oliveiro
4 Mar 25 i ii    ii   i   i`* Re: Which code style do you prefer the most?6Janis Papanagnou
4 Mar 25 i ii    ii   i   i `* Re: Which code style do you prefer the most?5Lawrence D'Oliveiro
4 Mar 25 i ii    ii   i   i  +- Re: Which code style do you prefer the most?1Keith Thompson
4 Mar 25 i ii    ii   i   i  `* Re: Which code style do you prefer the most?3Lawrence D'Oliveiro
5 Mar 25 i ii    ii   i   i   `* Re: Which code style do you prefer the most?2Janis Papanagnou
5 Mar 25 i ii    ii   i   i    `- Re: Which code style do you prefer the most?1Lawrence D'Oliveiro
21 Mar 25 i ii    ii   i   `* Re: Which code style do you prefer the most?6Tim Rentsch
22 Mar 25 i ii    ii   i    +* Re: Which code style do you prefer the most?2Tim Rentsch
22 Mar 25 i ii    ii   i    i`- Re: Which code style do you prefer the most?1Tim Rentsch
1 Apr04:46 i ii    ii   i    `* Re: 80 char lines and holerith cards [Was:Which code style do you prefer the most?]3Jakob Bohm
1 Apr08:46 i ii    ii   i     +- Re: 80 char lines and holerith cards [Was:Which code style do you prefer the most?]1Janis Papanagnou
1 Apr18:11 i ii    ii   i     `- Re: 80 char lines and holerith cards [Was:Which code style do you prefer the most?]1Janis Papanagnou
28 Feb 25 i ii    ii   `* Re: Which code style do you prefer the most?12Janis Papanagnou
28 Feb 25 i ii    ii    `* Re: Which code style do you prefer the most?11David Brown
28 Feb 25 i ii    ii     +* Re: Which code style do you prefer the most?9Richard Harnden
28 Feb 25 i ii    ii     i+- Re: Which code style do you prefer the most?1David Brown
28 Feb 25 i ii    ii     i`* Re: Which code style do you prefer the most?7Lawrence D'Oliveiro
1 Mar 25 i ii    ii     i `* Re: Which code style do you prefer the most?6Richard Harnden
1 Mar 25 i ii    ii     i  +* Re: Which code style do you prefer the most?4Richard Heathfield
1 Mar 25 i ii    ii     i  i`* Re: Which code style do you prefer the most?3Keith Thompson
1 Mar 25 i ii    ii     i  i +- Re: Which code style do you prefer the most?1Richard Harnden
1 Mar 25 i ii    ii     i  i `- Re: Which code style do you prefer the most?1David Brown
1 Mar 25 i ii    ii     i  `- Re: Which code style do you prefer the most?1Lawrence D'Oliveiro
1 Mar 25 i ii    ii     `- Re: Which code style do you prefer the most?1Janis Papanagnou
26 Feb 25 i ii    i+- Re: Which code style do you prefer the most?1David Brown
27 Feb 25 i ii    i+* Re: Which code style do you prefer the most?2Ar Rakin
27 Feb 25 i ii    ii`- Re: Which code style do you prefer the most?1David Brown
9 Mar 25 i ii    i`* Re: Which code style do you prefer the most?3Tim Rentsch
9 Mar 25 i ii    i `* Re: Which code style do you prefer the most?2Janis Papanagnou
10 Mar 25 i ii    i  `- Re: Which code style do you prefer the most?1Tim Rentsch
27 Feb 25 i ii    `* Re: Which code style do you prefer the most?42Lawrence D'Oliveiro
27 Feb 25 i ii     `* Re: Which code style do you prefer the most?41Janis Papanagnou
27 Feb 25 i ii      `* Re: Which code style do you prefer the most?40Lawrence D'Oliveiro
27 Feb 25 i ii       `* Re: Which code style do you prefer the most?39Janis Papanagnou
27 Feb 25 i ii        `* Re: Which code style do you prefer the most?38Lawrence D'Oliveiro
28 Feb 25 i ii         `* Re: Which code style do you prefer the most?37Janis Papanagnou
28 Feb 25 i ii          +* Re: Which code style do you prefer the most?33Richard Heathfield
28 Feb 25 i ii          i`* Re: Which code style do you prefer the most?32Janis Papanagnou
28 Feb 25 i ii          i `* Re: Which code style do you prefer the most?31Richard Heathfield
28 Feb 25 i ii          i  +- Re: Which code style do you prefer the most?1Janis Papanagnou
28 Feb 25 i ii          i  +* Re: Which code style do you prefer the most?4bart
28 Feb 25 i ii          i  i+* Re: Which code style do you prefer the most?2Michael S
28 Feb 25 i ii          i  ii`- Re: Which code style do you prefer the most?1Lawrence D'Oliveiro
28 Feb 25 i ii          i  i`- Re: Which code style do you prefer the most?1Ar Rakin
28 Feb 25 i ii          i  +- Re: Which code style do you prefer the most?1Chris M. Thomasson
28 Feb 25 i ii          i  +- Re: Which code style do you prefer the most?1Kaz Kylheku
28 Feb 25 i ii          i  `* Re: Which code style do you prefer the most?23Lawrence D'Oliveiro
1 Mar 25 i ii          i   `* Re: Which code style do you prefer the most?22David Brown
1 Mar 25 i ii          i    +* Re: Which code style do you prefer the most?20Janis Papanagnou
1 Mar 25 i ii          i    i`* Re: Which code style do you prefer the most?19Lawrence D'Oliveiro
1 Mar 25 i ii          i    i `* Re: Which code style do you prefer the most?18Janis Papanagnou
2 Mar 25 i ii          i    i  +* Re: Which code style do you prefer the most?12Keith Thompson
2 Mar 25 i ii          i    i  i+* Re: Which code style do you prefer the most?2Lawrence D'Oliveiro
2 Mar 25 i ii          i    i  ii`- Re: Which code style do you prefer the most?1Keith Thompson
2 Mar 25 i ii          i    i  i+- Re: Which code style do you prefer the most?1Tim Rentsch
2 Mar 25 i ii          i    i  i+- Re: Which code style do you prefer the most?1Janis Papanagnou
2 Mar 25 i ii          i    i  i+- Re: Which code style do you prefer the most?1Janis Papanagnou
2 Mar 25 i ii          i    i  i+* Re: Which code style do you prefer the most?3bart
2 Mar 25 i ii          i    i  ii+- Re: Which code style do you prefer the most?1Keith Thompson
2 Mar 25 i ii          i    i  ii`- Re: Which code style do you prefer the most?1Lawrence D'Oliveiro
2 Mar 25 i ii          i    i  i`* Re: Which code style do you prefer the most?3David Brown
2 Mar 25 i ii          i    i  i `* Re: Which code style do you prefer the most?2bart
2 Mar 25 i ii          i    i  i  `- Re: Which code style do you prefer the most?1David Brown
2 Mar 25 i ii          i    i  `* Re: Which code style do you prefer the most?5Janis Papanagnou
2 Mar 25 i ii          i    i   +* [OT] Pascal identifiers [digression] (was Re: Which code style do you prefer the most?)3Janis Papanagnou
2 Mar 25 i ii          i    i   i`* Re: [OT] Pascal identifiers [digression] (was Re: Which code style do you prefer the most?)2Keith Thompson
3 Mar 25 i ii          i    i   i `- Re: [OT] Pascal identifiers [digression] (was Re: Which code style do you prefer the most?)1Lawrence D'Oliveiro
2 Mar 25 i ii          i    i   `- Re: Which code style do you prefer the most?1Lawrence D'Oliveiro
1 Mar 25 i ii          i    `- Re: Which code style do you prefer the most?1Dan Cross
2 Mar 25 i ii          `* Re: Which code style do you prefer the most?3Tim Rentsch
25 Feb 25 i i`- Re: Which code style do you prefer the most?1Janis Papanagnou
25 Feb 25 i +- Re: Which code style do you prefer the most?1Ar Rakin
25 Feb 25 i `- Re: Which code style do you prefer the most?1Janis Papanagnou
25 Feb 25 +* Re: Which code style do you prefer the most?42John McCue
25 Feb 25 +* Re: Which code style do you prefer the most?2Rosario19
25 Feb 25 +- Re: Which code style do you prefer the most?1Janis Papanagnou
25 Feb 25 +* Re: Which code style do you prefer the most?57Lawrence D'Oliveiro
2 Mar 25 +- Re: Which code style do you prefer the most?1Tim Rentsch
4 Mar 25 +* Re: Which code style do you prefer the most?59Anton Shepelev
18 Mar 25 `- Re: Which code style do you prefer the most?1Bonita Montero

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal