Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #33384
| From | Eric Sosman <esosman@comcast-dot-net.invalid> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Never using booleans as parameters |
| Date | 2015-12-21 16:29 -0500 |
| Organization | A noiseless patient Spider |
| Message-ID | <n59qqt$cel$1@dont-email.me> (permalink) |
| References | (1 earlier) <MPG.30c53950e81a53589896a7@news.aioe.org> <n46p5b188kddl5h4jvtghhd531bka8iuio@4ax.com> <MPG.30e0dd2a49c4590e9896ab@news.aioe.org> <n59ncq$udk$1@dont-email.me> <7a6fa35b-701a-4954-b636-781d03b6bb79@googlegroups.com> |
On 12/21/2015 3:47 PM, Eric Douglas wrote:
> On Monday, December 21, 2015 at 3:31:05 PM UTC-5, Eric Sosman wrote:
>> On 12/20/2015 9:44 AM, Brixomatic wrote:
>>> [...]
>>> Code IS documentation, if properly written.
>>
>> Corollary: Properly-written code is comment-free. ;-)
>>
>> Corollary II: Languages that support comments encourage
>> improperly-written code. :-)
>>
>> Only half a :-), though. Long ago I read of an experiment --
>> it may have been reported in Weinberg's "The Psychology of Computer
>> Programming" -- in which computer science students were given other
>> people's code to debug. Half the students received the code as it
>> stood, the others got the code with all comments removed. The no-
>> comment group found and fixed more bugs, and faster, than the group
>> with the "benefit" of the comments. (It's easy to speculate on the
>> reasons for this, but speculation is only about, oh, 54.7% reliable.)
>
> Comment free code that is not self documenting takes up less disk space.
> Don't ever use whitespace if whitespace is not required.
> All variable names should be as short as possible ie A0,A1,A2.
> This is what code looked like just a couple decades ago.
>
> About 71.3% of all statistics are made up on the spot.
Anecdote: In my long-distant Bright College Days, when the school's
only computer filled a room, had an eighth of a megabyte of memory, and
executed about 1e5 instructions per second, a lot of code was written in
assembly language to get the utmost out of limited resources. Some of
us students earned pocket money by writing things for the Computer
Center, and one guy in particular wrote his stuff with the apparent aim
of minimizing keypunching time (recall that I said "long-distant"):
...
L 0,VARA
SLA 0,1
AL 0,VARB
ST 0,VARC
...
The long-suffering staffer who oversaw us rowdies threw a fit at
this guy's code, and wouldn't accept it. "Comments! Where are the
comments? And use equates for the register numbers, so they'll show up
in the cross-reference listing! And line up the columns in the normal
way! Take this crap away, and bring it back when you've done it right!
The back o' me hand to ye, and out of my sight!"
The student went away and wrote a "TIDY" program for his assembly
code, dumped his original deck through it, and re-submitted:
R0 EQU 0 SYMBOL FOR REGISTER 0
R1 EQU 1 SYMBOL FOR REGISTER 1
...
R15 EQU 15 SYMBOL FOR REGISTER 15
...
L R0,VARA LOAD R0 FROM VARA
SLA R0,1 SHIFT R0 LEFT 1 BIT
AL R0,VARB ADD VARB TO R0
ST R0,VARC STORE R0 TO VARC
...
The overseer accepted this "fully-commented" code. It's not clear
whether he simply didn't notice that the comments were meaningless or
realized that expostulation would get him nowhere ...
--
esosman@comcast-dot-net.invalid
"Don't be afraid of work. Make work afraid of you." -- TLM
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Find similar | Unroll thread
Never using booleans as parameters Cecil Westerhof <Cecil@decebal.nl> - 2015-11-20 09:29 +0100
Re: Never using booleans as parameters Martin Gregorie <martin@address-in-sig.invalid> - 2015-11-20 11:54 +0000
Re: Never using booleans as parameters Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-11-20 08:30 -0500
Re: Never using booleans as parameters Eric Douglas <e.d.programmer@gmail.com> - 2015-11-20 05:57 -0800
Re: Never using booleans as parameters Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-11-20 09:17 -0500
Re: Never using booleans as parameters Eric Douglas <e.d.programmer@gmail.com> - 2015-11-20 05:34 -0800
Re: Never using booleans as parameters Silvio <silvio@internet.com> - 2015-11-20 18:18 +0100
Re: Never using booleans as parameters Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-11-20 16:08 -0500
Re: Never using booleans as parameters Silvio <silvio@internet.com> - 2015-11-23 14:12 +0100
Re: Never using booleans as parameters Silvio <silvio@internet.com> - 2015-11-23 14:23 +0100
Re: Never using booleans as parameters Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-11-23 08:42 -0500
Re: Never using booleans as parameters Silvio <silvio@internet.com> - 2015-11-23 15:14 +0100
Re: Never using booleans as parameters Eric Douglas <e.d.programmer@gmail.com> - 2015-11-23 06:10 -0800
Re: Never using booleans as parameters Arne Vajhøj <arne@vajhoej.dk> - 2015-11-29 15:45 -0500
Re: Never using booleans as parameters Martin Gregorie <martin@address-in-sig.invalid> - 2015-11-30 00:08 +0000
Re: Never using booleans as parameters Arne Vajhøj <arne@vajhoej.dk> - 2015-11-29 19:32 -0500
Re: Never using booleans as parameters Arne Vajhøj <arne@vajhoej.dk> - 2015-11-29 19:39 -0500
Re: Never using booleans as parameters Brixomatic <brixomatic@yahoo.com> - 2015-12-20 15:08 +0100
Re: Never using booleans as parameters Eric Douglas <e.d.programmer@gmail.com> - 2015-12-21 05:00 -0800
Re: Never using booleans as parameters Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-12-21 08:53 -0500
Re: Never using booleans as parameters Gene Wirchenko <genew@telus.net> - 2015-11-30 10:33 -0800
Re: Never using booleans as parameters Jukka Lahtinen <jtfjdehf@hotmail.com.invalid> - 2015-12-02 15:51 +0200
Re: Never using booleans as parameters Kevin McMurtrie <mcmurtrie@pixelmemory.us> - 2015-11-23 21:55 -0800
Re: Never using booleans as parameters Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-11-24 08:23 -0500
Re: Never using booleans as parameters Kevin McMurtrie <mcmurtrie@pixelmemory.us> - 2015-11-27 22:52 -0800
Re: Never using booleans as parameters Arne Vajhøj <arne@vajhoej.dk> - 2015-11-29 15:55 -0500
Re: Never using booleans as parameters leif.roar@dimnakorr.com - 2015-11-20 11:44 -0600
Re: Never using booleans as parameters Eric Douglas <e.d.programmer@gmail.com> - 2015-11-20 10:08 -0800
Re: Never using booleans as parameters Arne Vajhøj <arne@vajhoej.dk> - 2015-11-22 14:03 -0500
Re: Never using booleans as parameters Gene Wirchenko <genew@telus.net> - 2015-11-20 10:14 -0800
Re: Never using booleans as parameters Eternal Hope <laughingspam99@gmail.com> - 2015-11-22 14:27 +0000
Re: Never using booleans as parameters Kevin McMurtrie <mcmurtrie@pixelmemory.us> - 2015-11-20 20:13 -0800
Re: Never using booleans as parameters Eric Douglas <e.d.programmer@gmail.com> - 2015-11-23 04:59 -0800
Re: Never using booleans as parameters Arne Vajhøj <arne@vajhoej.dk> - 2015-11-29 15:53 -0500
Re: Never using booleans as parameters galt_57@hotmail.com - 2015-11-22 09:02 -0800
Re: Never using booleans as parameters Arne Vajhøj <arne@vajhoej.dk> - 2015-11-22 12:20 -0500
Re: Never using booleans as parameters Arne Vajhøj <arne@vajhoej.dk> - 2015-11-22 12:41 -0500
Re: Never using booleans as parameters Martin Gregorie <martin@address-in-sig.invalid> - 2015-11-22 18:06 +0000
Re: Never using booleans as parameters Gene Wirchenko <genew@telus.net> - 2015-11-25 14:21 -0800
Re: Never using booleans as parameters Arne Vajhøj <arne@vajhoej.dk> - 2015-11-29 15:58 -0500
Re: Never using booleans as parameters Gene Wirchenko <genew@telus.net> - 2015-11-30 10:39 -0800
Re: Never using booleans as parameters Brixomatic <brixomatic@yahoo.com> - 2015-11-29 16:40 +0100
Re: Never using booleans as parameters Arne Vajhøj <arne@vajhoej.dk> - 2015-11-29 16:00 -0500
Re: Never using booleans as parameters Arne Vajhøj <arne@vajhoej.dk> - 2015-11-29 19:26 -0500
Re: Never using booleans as parameters Eric Douglas <e.d.programmer@gmail.com> - 2015-11-30 06:16 -0800
Re: Never using booleans as parameters Arne Vajhøj <arne@vajhoej.dk> - 2015-11-22 14:01 -0500
Re: Never using booleans as parameters Fredrik Jonson <fredrik@jonson.org> - 2015-11-24 18:50 +0000
Re: Never using booleans as parameters Sir Hugh Jarce <hugh@example.com> - 2015-11-27 10:07 +0000
Re: Never using booleans as parameters Arne Vajhøj <arne@vajhoej.dk> - 2015-11-29 15:49 -0500
Re: Never using booleans as parameters Brixomatic <brixomatic@yahoo.com> - 2015-11-29 16:33 +0100
Re: Never using booleans as parameters Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-11-29 15:57 -0500
Re: Never using booleans as parameters Arne Vajhøj <arne@vajhoej.dk> - 2015-11-29 16:01 -0500
Re: Never using booleans as parameters Brixomatic <brixomatic@yahoo.com> - 2015-12-20 15:00 +0100
Re: Never using booleans as parameters Gene Wirchenko <genew@telus.net> - 2015-12-21 10:50 -0800
Re: Never using booleans as parameters Gene Wirchenko <genew@telus.net> - 2015-11-30 10:48 -0800
Re: Never using booleans as parameters Brixomatic <brixomatic@yahoo.com> - 2015-12-20 15:44 +0100
Re: Never using booleans as parameters Gene Wirchenko <genew@telus.net> - 2015-12-21 10:56 -0800
Re: Never using booleans as parameters Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-12-21 15:30 -0500
Re: Never using booleans as parameters Eric Douglas <e.d.programmer@gmail.com> - 2015-12-21 12:47 -0800
Re: Never using booleans as parameters Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-12-21 16:29 -0500
csiph-web