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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,7728b533f7ab5fb6 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!feeder.erje.net!feeder2.news.saunalahti.fi!feeder1.news.saunalahti.fi!nntp.inet.fi!central1.inet.fi!inet.fi!read4.inet.fi.POSTED!53ab2750!not-for-mail Sender: AWI003@FIW9752 Newsgroups: comp.lang.ada Subject: Re: Avoiding side effects and other dogma. References: From: Anders Wirzenius Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Tue, 14 Oct 2008 06:22:49 GMT NNTP-Posting-Host: 194.251.142.2 X-Complaints-To: abuse@inet.fi X-Trace: read4.inet.fi 1223965369 194.251.142.2 (Tue, 14 Oct 2008 09:22:49 EEST) NNTP-Posting-Date: Tue, 14 Oct 2008 09:22:49 EEST Organization: Sonera Customer Xref: g2news1.google.com comp.lang.ada:2371 Date: 2008-10-14T06:22:49+00:00 List-Id: "(see below)" writes: > On 13/10/2008 13:27, in article uabd8adeb.fsf@no.email.thanks.invalid, > "Anders Wirzenius" wrote: > > > > Is the dogm you refer to something like "functions without side > > effects". > > That's just one of many, along with: "never use goto", "never use > exceptions", "never use 'use' clauses", "never use pointers", "the OO > approach is always right", "the market is always right", etc, etc, etc. > > > > > I am not a professional programmer any more and I just > > wanted to learn something about side effects. What is silly in that? > > What is silly is tying yourself in knots to avoid a perfectly sensible way > of doing something, because it is abominated by the adherents of a dogma. > > The trouble is that bright people (Dijkstra, Hoare, Dahl, etc) offer > recommendations for general approaches, to be applied with common sense; but > then their much dimmer followers turn the recommendations into religions. > > I encountered this a lot as a teacher. I remember giving a lecture on memory > management techniques and being confronted at the end by one a student who > demanded that I should say which was "the best". When I explained it was not > possible to do that, he insisted that I really knew which was the best and > was keeping the secret to myself. > > Too many software practitioners (among many others) have that mindset. As a teacher you may then be familiar with the difference between "wanting to learn" and "programming for production". To me it is a good technique to "strive for perfection" if you use that as a tool for learning something about a subject. You may write a program using a goto whenever you have a need for jumping somewhere and after that write another version of the program without a single goto. And then write a third version adopting yet another dogma. The three versions are useless once you have made up your mind about the consequences of adopting different principles. You throw those versions in the recycle bin and start to write the "common sense" adopted program version. And keep that. -- Anders