Path: csiph.com!news.swapon.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Eric Sosman Newsgroups: comp.lang.java.programmer Subject: Re: Never using booleans as parameters Date: Mon, 21 Dec 2015 16:29:24 -0500 Organization: A noiseless patient Spider Lines: 70 Message-ID: References: <87lh9tysy8.fsf@Equus.decebal.nl> <7a6fa35b-701a-4954-b636-781d03b6bb79@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Mon, 21 Dec 2015 21:26:53 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="2d081e2f7155c28005d4472f67c2f43d"; logging-data="12757"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18Tz7bbdUgJa32D4vtyo9fc" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 In-Reply-To: <7a6fa35b-701a-4954-b636-781d03b6bb79@googlegroups.com> Cancel-Lock: sha1:75V3Nnvg76yNlTM0nBGO0DWQ8IY= Xref: csiph.com comp.lang.java.programmer:33384 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