From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: *** X-Spam-Status: No, score=3.8 required=5.0 tests=BAYES_00,INVALID_MSGID, RATWARE_MS_HASH,RATWARE_OUTLOOK_NONAME autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fc89c,97188312486d4578 X-Google-Attributes: gidfc89c,public X-Google-Thread: 109fba,baaf5f793d03d420 X-Google-Attributes: gid109fba,public X-Google-Thread: 1014db,6154de2e240de72a X-Google-Attributes: gid1014db,public X-Google-Thread: 103376,97188312486d4578 X-Google-Attributes: gid103376,public From: "Tim Behrendsen" Subject: Re: What's the best language to start with? [was: Re: Should I learn C or Pascal?] Date: 1996/08/12 Message-ID: <01bb8802$a5ff3a60$32ee6fce@timhome2>#1/1 X-Deja-AN: 173622453 references: <31FBC584.4188@ivic.qc.ca> <01bb83ad$29c3cfa0$87ee6fce@timpent.airshields.com> <4u89c4$p7p@solutions.solon.com> <01bb83f5$923391e0$87ee6fce@timpent.airshields.com> <4uah1k$b2o@solutions.solon.com> <01bb853b$ca4c8e00$87ee6fce@timpent.airshields.com> <320b35a2.43769707@nntp.ix.netcom.com> <01bb8609$59339140$87ee6fce@timpent.airshields.com> <320bf032.7193774@nntp.ix.netcom.com> content-type: text/plain; charset=ISO-8859-1 organization: A-SIS mime-version: 1.0 newsgroups: comp.lang.c,comp.lang.c++,comp.unix.programmer,comp.lang.ada Date: 1996-08-12T00:00:00+00:00 List-Id: Mike Rubenstein wrote in article <320bf032.7193774@nntp.ix.netcom.com>... > "Tim Behrendsen" wrote: > > Mike Rubenstein wrote in article > > <320b35a2.43769707@nntp.ix.netcom.com>... > > Perhaps because you think like an assembly language programmer -- > there's an enormous advantage to clear code. Efficiency may, or may > not be important. Yet you assumed that it was worthwhile to make > Peter's code more efficient. This is the assembly language > programmer's disease. No, this is experienced programmer's disease. It's not as if I go around optimizing everything, I just do it automatically. When you train yourself to think about efficiency, you naturally do it the efficient way the *first time*. The cumulative effect of this is fast programs, and it doesn't cost any more effort. > If I were doing a lot of gcd calculations, I'd certainly try to > optimize the program. But in most applications very little of the > code is time critical. Where it is not, clear code wins over > efficient code. Yes, I agree. Personally, they both seem equally clear to me, but I could see how someone may prefer the recursive solution. It is certainly the more "beautiful" of the two. > Furthermore, when teaching algorithms Peter's code is what you want, > at least for the first cut. It shows a general technique of algorithm > design, reducing a problem to a similar but easier one, that your > code, even if written correctly, hides. I'm not sure if that's good or not. One of the famous ways to show recursion is a factorial computation. Does that mean we actually *want* people to implement factorial that way? -- Tim Behrendsen (tim@airshields.com)