🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.folklore.computers
Article #620755

Re: Nostalgia

#620755
From: Jorgen Grahn
Date: Tue, 27 Feb 2018 12:15
66 lines
4141 bytes
On Tue, 2018-02-27, J  Clarke wrote:
> On 26 Feb 2018 11:32:49 GMT, Jorgen Grahn <grahn...@snipabacken.se>
> wrote:
>
>>On Mon, 2018-02-26, J  Clarke wrote:
>>> On 26 Feb 2018 06:43:24 GMT, Jorgen Grahn <grahn...@snipabacken.se>
>>> wrote:
>>>
>>>>On Mon, 2018-02-26, Dan Espen wrote:
...
>>>>> In the above case, the code still needs a comment
>>>>> but it should be something like:
>>>>>
>>>>> x=5;		# Max supported fingers
>>>>
>>>>max_supported_fingers=5;  # Nothing more to say
>>>
>>> But a lot more to type and that style tends to be hard to
>>> read--operators get lost in the visual noise.
>>
>>A lot more to type, but a lot less to remember.  I agree that the
>>visual noise aspect is a problem, though.
>>
>>It depends on the context.  For very local variables I tend to favor
>>one-letter names like i (for iteration), p, q (pointers), n and m
>>(quantities and sizes).
>
> I used to do that but realized that it's a bad habit for a variety of
> reasons.  (Working in insurance and using APL has a lot to do with it
> I think).  First, single letter variable names are hard to search on.

But you don't usually search for names which have a scope limited to
(say) 5--10 lines.

   (Note the irony, which is typical for coding style discussions: I
   had to defend using long, descriptive variable names, and now I'm
   defending using one-letter ones.  Consistency is overrated.)

> So are variable names that form parts of common words.  Second, once
> the habit develops, it's easy to run out of variable names and end up
> using "l" (lower case L), which is identical to "1" (one) in many
> fonts which can lead to very difficult to identify bugs.

Hm, I've never seen that problem arise.  It would indeed be a problem,
and a symptom of an underlying problem. Generally, I limit the number
of variables in scope at any given time, because code is harder to get
wrong when there are few moving parts.

> Third, actuarial science has its share of accepted one letter
> values--"Q" for example is mortality.

Ok. Well, I didn't mean to suggest my set of names are always
applicable everywhere.

> Then there's the guy who used Z for whatever was returned by a
> function, _any_ function..  But somehow Z managed to escape and become
> globalized, so finding out what changed Z becomes a major undertaking.
>
>>  I allow global names to be longer, but look
>>for ways to abbreviate them too.

/Jorgen

-- 
  // Jorgen Grahn <grahn@  Oo  o.   .     .
\X/     snipabacken.se>   O  o   .
Technical Details
Message-ID: <slrnp9aiv3.eu5.grahn+nntp@frailea.sa.invalid>
Path: mbox-mo1.pugleaf.net!a25ni440itj.0!nntp.google.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!goblin1!goblin.stu.neva.ru!news.albasani.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
References: <p67o2727bv@news1.newsguy.com> <p6967v$t5b$1@dont-email.me> <p6q0kb$t5$1@reader2.panix.com> <2MWdnbgKEKQjRA_HnZ2dnUU78XHNnZ2d@giganews.com> <ffga3cFrifbU1@mid.individual.net> <ffgu5uF5nalU15@mid.individual.net> <1313349967.541300884.430961.peter_flass-yahoo.com@news.eternal-september.org> <p6vrnc$ue5$1@dont-email.me> <slrnp97b4c.eu5.grahn+nntp@frailea.sa.invalid> <0lq79dpae03ai000r0690fja58qcud4udu@4ax.com> <slrnp97s31.eu5.grahn+nntp@frailea.sa.invalid> <3ve99dtbi7vu0jda6ut1kcbemr6j4ta28v@4ax.com>

Show Full Headers
Complete Article Headers
X-Received: by 10.36.77.74 with SMTP id l71mr11105958itb.25.1519733733853;        Tue, 27 Feb 2018 04:15:33 -0800 (PST)
X-BeenThere: alt.folklore.computers@googlegroups.com
Received: by 10.107.101.12 with SMTP id z12ls190302iob.20.gmail; Tue, 27 Feb 2018 04:15:32 -0800 (PST)
X-Received: by 10.107.111.17 with SMTP id k17mr10853849ioc.28.1519733732661;        Tue, 27 Feb 2018 04:15:32 -0800 (PST)
MIME-Version: 1.0
Path: mbox-mo1.pugleaf.net!a25ni440itj.0!nntp.google.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!goblin1!goblin.stu.neva.ru!news.albasani.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: Jorgen Grahn <grahn...@snipabacken.se>
Newsgroups: alt.folklore.computers
Subject: Re: Nostalgia
Date: 27 Feb 2018 12:15:31 GMT
Lines: 66
Message-ID: <slrnp9aiv3.eu5.grahn+nntp@frailea.sa.invalid>
References: <p67o2727bv@news1.newsguy.com> <p6967v$t5b$1@dont-email.me> <p6q0kb$t5$1@reader2.panix.com> <2MWdnbgKEKQjRA_HnZ2dnUU78XHNnZ2d@giganews.com> <ffga3cFrifbU1@mid.individual.net> <ffgu5uF5nalU15@mid.individual.net> <1313349967.541300884.430961.peter_flass-yahoo.com@news.eternal-september.org> <p6vrnc$ue5$1@dont-email.me> <slrnp97b4c.eu5.grahn+nntp@frailea.sa.invalid> <0lq79dpae03ai000r0690fja58qcud4udu@4ax.com> <slrnp97s31.eu5.grahn+nntp@frailea.sa.invalid> <3ve99dtbi7vu0jda6ut1kcbemr6j4ta28v@4ax.com>
X-Trace: individual.net 5qvjHmbq2JI+1/oLR5TURgv0/yk2CFRITGZMrYXR15csvXUo3A
Cancel-Lock: sha1:hNTTaCzm3zhqo4O4nmOClFOlX0U=
User-Agent: slrn/1.0.2 (OpenBSD)
Bytes: 3669
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit