The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: Jon Steinhart <jon@fourwinds.com>
To: The Eunuchs Hysterical Society <tuhs@tuhs.org>
Subject: Re: [TUHS] The Elements Of Style: UNIX As Literature
Date: Fri, 06 Nov 2020 10:51:11 -0800	[thread overview]
Message-ID: <202011061851.0A6IpB7p555742@darkstar.fourwinds.com> (raw)
In-Reply-To: <20201106150609.GR26296@mcvoy.com>

Larry McVoy writes:
> On Fri, Nov 06, 2020 at 05:37:25PM +1100, Greg 'groggy' Lehey wrote:
> > On Friday,  6 November 2020 at  0:04:28 -0500, John Cowan wrote:
> > > On Thu, Nov 5, 2020 at 8:41 PM Larry McVoy <lm@mcvoy.com> wrote:
> > >
> > >> I click but I mostly live in terminal windows.  Which are all 80
> > >> columns because that's the right width (I can go on and on about
> > >> that).
> > >
> > > Aw, c'mon.  You're going to tell us that the number of punch holes
> > > that IBM could fit on a punch card in 1928 that was exactly the size
> > > of the dollar bill used in the U.S. from 1862 to 1923 so that it
> > > could be stored in a mechanical cash register is miraculously the
> > > Right Thing when it comes to reading monospaced text on a screen?
> > 
> > I think you're jumping to conclusions.  The importance of 80
> > characters (for small values of 80) is that it's a comfortable text
> > width for human eyes.  
>
> Exactly this.  I'm a very fast reader, easily 2-3x the average.  I read by
> running my eyes down the middle of the page and get the left and right
> from peripheral vision.  It's super fast but it doesn't work when you
> get much bigger than 80 columns.
>
> Even if you read normally, the wider it is, the more back and forth your
> eyes do so less is more.
>
> It's also why I'm fine with smaller screens, I tried the giant apple
> displays and found that those required head movement along with eye
> movement.

We're getting into religion again here, and I've never found that to be a
sound basis for policy.  I'm going to quote liberally here from a screed
that I wrote (but have not published) when trying to understand parts of
the linux kernel.

I've always been willing to spend buckets of money on the monitors because
to me that's an area where bigger and higher resolution is always better.
I've been using 132 column terminal windows since sometime in the 90s when
I got myself a monster 24" Trinitron monitor from Sun.  I seem to recall
that it listed for $3,300, thanks to the unnamed person who got me the
employee discount :-)  I tried going to 160 columns but that was too wide
for the monitors that people I worked with had.

I hated Shakespeare in high school.  One of the big reasons was that I felt
that he made up a word whenever he didn't have a good one available.  The
flipping back and forth to the list of definitions completely interrupted
the cadence of reading.  The insistence on short line lengths in coding
standards and the contortions that people go through to meet them has the
same effect for me.

I've coined the phrase "mental locality of reference" to describe this; at
least I think that I'm the first one to use it.  Short lines and modern coding
styles ask the human brain to contort itself in ways that we are loath to ask
hardware to do.

As near as I can tell, the belief that people do best with line lengths between
50 and 75 characters long is the result of people repeating "wisdom" that they
heard from someone else that orginates from what I consider to be a misreading
of Emil Ruder's book "Typographie: A Manual of Design".  While Ruder does make
this statement about line length, it's in the context of normal typography.
It does not even remotely consider computer code where long lines are long
mainly due to leading whitespace.  To the best of my knowledge nobody has
studied this - does the line length when counting begin at the first column or
the first non-whitespace character?

While readers might "lose focus" part of the way through long lines, that has to
be balanced against the loss of focus that comes from 'mental carriage-returns"
when text is too narrow and broken across several lines.  Again, not studied as
far as I know.

The linux coding standard makes the unsubstantiated claim that having more than
three levels of indent is a problem.  And it's really hard to understand,
because on one hand, it says that you "should fix your program", and then says
that "nesting functions too deep" is a problem.  Sounds like a catch-22 to me;
how are you going to minimize indent if you can't nest functions?  I'm guessing
that someone typed this without reading what they wrote and really meant
"statements", not "functions".

We're back to the mental locality-of-reference thing that was mentioned earlier.
I'd much rather have a few more levels of indent and longer lines than have to
go chasing gratuitous function calls.  Think about every diversion from the
stuff in front of you as a cache miss.

When I look at the linux kernel code, I see incredibly bad contortions made in
attempts to meet the coding style.  I also observed that the code only loosely
follows its coding style.  How are people limiting their code to three indent
levels?  By including dozens of header files that contain static inline
functions.  Gak!  I feel that style rules should be observed in some sort of
priority order, and mental locality of reference, which isn't in anybody's
rules but mine, is at the top of the list.

I could go on, but hopefully I've made my point.

Jon

  parent reply	other threads:[~2020-11-06 18:51 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-05 22:10 Tyler Adams
2020-11-06  0:39 ` Kevin Bowling
2020-11-06  1:41 ` Larry McVoy
2020-11-06  5:04   ` John Cowan
2020-11-06  5:16     ` Steve Nickolas
2020-11-06  6:34     ` Rob Pike
2020-11-06 13:20       ` Will Senn
2020-11-06 15:07         ` Clem Cole
2020-11-06 15:40           ` Will Senn
2020-11-06 15:46             ` Chris Torek
2020-11-06 22:54               ` Greg 'groggy' Lehey
2020-11-06 23:29                 ` Steffen Nurpmeso
2020-11-06 22:31           ` Dave Horsfall
2020-11-06 23:41             ` Warren Toomey
2020-11-06  6:37     ` Greg 'groggy' Lehey
2020-11-06 15:06       ` Larry McVoy
2020-11-06 15:18         ` Bakul Shah
2020-11-06 15:19         ` Chris Torek
2020-11-06 16:46           ` Stephen Clark
2020-11-06 18:51         ` Jon Steinhart [this message]
2020-11-06 22:09           ` John Cowan
2020-11-06 22:44             ` Jon Steinhart
2020-11-06 22:12         ` Andy Kosela
2020-11-06 22:23           ` Larry McVoy
2020-11-07  0:16             ` Dave Horsfall
2020-11-08 23:23               ` George Michaelson
2020-11-06 17:05       ` Paul Winalski
2020-11-06 17:07         ` Larry McVoy
2020-11-06 17:25           ` Warner Losh
2020-11-06 17:13       ` Adam Thornton
2020-11-06 17:26         ` Stephen Clark
2020-11-06 18:24           ` John Cowan
2020-11-06 21:10   ` Dave Horsfall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202011061851.0A6IpB7p555742@darkstar.fourwinds.com \
    --to=jon@fourwinds.com \
    --cc=tuhs@tuhs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).