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!news2.google.com!postnews.google.com!l33g2000pri.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: Avoiding side effects Date: Mon, 13 Oct 2008 14:22:08 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1223932929 19211 127.0.0.1 (13 Oct 2008 21:22:09 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 13 Oct 2008 21:22:09 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: l33g2000pri.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.12) Gecko/20050922 Fedora/1.7.12-1.3.1,gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:2366 Date: 2008-10-13T14:22:08-07:00 List-Id: On Oct 13, 11:49 am, "(see below)" wrote: > 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. [snip] > 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. Or even worse... they turn it into department policy. It seems like I've seen too many indicences on comp.lang.ada where a poster wasn't allowed to use a particular construct, even if it was the best one for their particular situation, because of a department policy not to use . I've fallen victim to the religion thing, though; when Dijkstra's "Gotos considered harmful" article came out, I was a COBOL programmer for the school district at the time, and most of the existing programs was truly abominably-written spaghetti code, and probably so were most of mine at the time. But I (**** SAW THE LIGHT ****) and started avoiding GOTO's like the plague, which was quite difficult because COBOL at the time did not have decent control structures---no loops, just PERFORM paragraph UNTIL, and no "if...end if" or "begin...end" constructs so that IF's couldn't always be nested inside other IF's with generality, so I was doing things like moving code sequences down to separate paragraphs so that I could PERFORM them. I guess it did make my code better than spaghetti, but it was still pretty contorted, and it took some time and a Yourdon book to realize that was I was doing was silly and unproductive, and started using GOTOs in a more sensible manner. I wouldn't say I was particularly "dim" at the time, just inexperienced, perhaps not surprising since I was only about sixteen at the time. But you're absolutely right. The most important thing is to learn what makes a program readable and maintainable. Sometimes this just takes experience. But no matter what, dogmas are a very poor substitute for this kind of learning and experience. With a few exceptions... I still think "don't ever use ALTER statements" is probably a good dogma for COBOL programmers. The spaghetti-code programmers who wrote the old software loved using them, and they always made code difficult to follow. So I guess even the "no dogmas" dogma is the kind of dogma that should be avoided... -- Adam