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 : 28. Feb 2025, 10:00:42
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vprtvs$3jfqu$1@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10
User-Agent : Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0
On 27.02.2025 16:47, David Brown wrote:
On 27/02/2025 06:57, Janis Papanagnou wrote:
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.
>
[...]
>
Since decades now there are no such hard limits, so why do you make
up such a statement.
 
That's exactly the point - there /are/ no real hard limits, and have not
been any since we moved on from pure text-mode terminals.  Some
situations have short line limits (such as for a slideshow in a
presentation), most situations for normal coding can be as wide as the
developer finds convenient.

With presentations I've noticed another extremely strange (human)
behavior. Lastly I worked in a context where they used PPT as medium
for all sorts of text communication; evaluations, documentation, etc.
Because of the auto-adjustment of font-sizes depending on the amount
of text they stuffed many PPT slides full of information so that the
resulting text became something like a 6pt text with extremely long
lines. - I've in a recent posting mentioned that my hypothesis is
that the available/used medium influences what you get as outcome,
and some consider less whether it's readable in the first place.

 
So why do some people think that 80 columns should be a hard limit to
their line length?  They do not, for the most part, think 80 characters
is ideal for readability, or for display, or for printing, or for
writing code, or for reviewing it, or for any other use.  For the most
part, they don't think at all.  They simply regurgitate 80 columns
because IBM picked 80 columns as the width of punched cards in 1928.  If
IBM had picked 72 columns or 96 columns, Bradley would have written
"Just do your best to keep it neat and under 72 columns" or "Just do
your best to keep it neat and under 96 columns".

That is IMO not accurately describing it (given that some columns on
the punch cards in languages of these days had a special meaning and
were not available for program text). But I had already commented on
the historic evolution before and also said that some _sensible_ size
(as opposed to an arbitrary size) had been chosen. (I won't reiterate
that here.)

[...]
 
In newspapers you can find articles that can span even a whole page.
It's nonetheless organized in small columns.
 
Of course different newspapers do things differently.

Most (all?) newspapers (at least hereabouts) do things quite similarly.

 
And maybe there are other reasons for having columns that are often far
too narrow for legibility, sometimes leading to horrible inconsistent
spacing, really messy hyphenation, and the like.

I agree that too narrow columns are as well a problem.

 
Columns are clearly required for newspapers - the pages are (usually)
far too wide to be comfortable to read without splitting up into
columns.  The question is what width they should be.
 
Generally, around 60 - 70 characters is common for quick, easy reading,
such as most books.  Technical documents can have a good deal more - a
quick check suggests that the C standards have around 90 characters per
line, while the C++ standards (with a smaller typeface) have about 105.
A technical white paper that I happen to have open at the moment has 120
character lines.
 
Newspaper columns are often much shorter - 30 to 40 characters.  So why
is that?
 
The prime purpose of a newspaper is, obviously, to make money.  The more
you put in the same area, the better.  Having regular column sizes
reduces costs (especially before computer-based layout and printing). It
makes it easier to sell advertising space.

I take this as your opinion (or hypothesis).

 
Modern newspapers can be more flexible in their layouts, but keeping a
familiar look is important.  Legibility of individual columns of text is
much less important - after all, most readers scan headlines and only
read a small proportion of the column text.

I cannot speak for "most readers", so I don't want to comment on that
part of your statement.

WRT [online-] layout of "modern newspapers" I observe various things
(in my domain); one is that lines of 60-70 columns are quite typical
now. Another observation is that some media don't care any more about
legibility of (longer) texts by using or switching to sans-serif fonts.

>
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.
>
 
What did you actually look at?  Novels?  Textbooks?  Documents written
for A4 page sizes?  Newspapers?  Old legal documents?

As I wrote; all sorts of texts. Novels (in various editing forms, and
written in DE, EN, and GR), technical books (EN and DE), old (historic)
books and new editions, and so on. - All books more or less conform to
the established values.

(Yes, there are of course variances, but all in the discussed ranges.)

 
So I have to conclude that printed typical text would fit regularly
and easily in an 80 column mono-spaced medium.
>
 
Your conclusion would be wrong, unless you are limiting it to specific
areas.  (The word "typical" is very vague.)

Yes, the word is vague; but using any absolute term would be wrong and
only provoke that one interested in arguing would pick up a "counter
example". - It's the _typical_ "state of the art" that matters! (YMMV.)

>
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...
>
 
I agree that readability is key here.  But remember that readability of
code is not the same thing as readability of prose.

Sure. (Please note my respective statements in some of my other posts
concerning that.)

Doing too much in
one line of code makes it hard to understand - regardless of how many
characters it actually uses.

I think we should abandon speaking about it in terms of characters.

(I think we agreed that readability is the key, not a hard or soft
column limit; typically used number of columns are nonetheless based
on cultural - you may say also technical; still based on cultural -
sensible heuristics. But habits seem to run out of control "lately".)

Taking something that is logically one
operation or expression and artificially splitting it into two (or more)
lines to suit an arbitrary line length limit also makes the code hard to
understand. [...]

This may be the case or not. - That's the whole point; to organize the
code to become clear. - A split may make it even better readable. (But
a _misplaced_ split may make it worse.)

Is that split in your opinion reducing readability...?

        if (sscanf (mutations, "r:%u,g:%u,a:%u,d:%u",
                    &mutation_rates.base,
                    &mutation_rates.genesis,
                    &mutation_rates.aging,
                    &mutation_rates.death
                   ) != 4)

or would you prefer it for (better?) readability to be in one line?

 
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.
 
That seems small to me.

Do you mean my screen or my default window size setting?

I cannot help; I'm used to the two 24" screens that I have, and my age
and health does not allow to regularly use font's below 10pt (or so).

I have no problem with two approximately
120-column windows side-by-side in my IDE,

This actually explains your preferences; elsethread I wrote about my
observations of people using larger defaults for window sizes, and
specifically that I've observed IDE users to work with larger default
window sizes also regularly don't mind writing code with (even much)
longer lines.

along with all the additional
junk - file lists, code outlines, line numbers, scroll bars, etc.
Sometimes I will have three files side-by-side, with a bit less space
for the junk, depending on what I am doing.  (I usually have other stuff
like command windows, serial terminals, webpages, documents, etc., on
the other screens.)
 
[...]
 
Sure.  I do the same, for the same reasons.  But I don't restrict myself
to so short line lengths.  (Of course most of the lines in my code are
shorter than 80 characters.)

I've earlier this morning posted some statistical data in this thread.

(Given what you write here my guess is that our habits actually don't
differ too much. And I think also our reasoning is not too different
in principle, if I've read your post correctly. - Our differences are
probably only in our observation, experiences, opinions, hypotheses,
concerning the historic or cultural background.)

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 Apr 25 i ii    ii   i    `* Re: 80 char lines and holerith cards [Was:Which code style do you prefer the most?]3Jakob Bohm
1 Apr 25 i ii    ii   i     +- Re: 80 char lines and holerith cards [Was:Which code style do you prefer the most?]1Janis Papanagnou
1 Apr 25 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