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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,4b06f8f15f01a568 X-Google-Attributes: gid103376,public From: Richard D Riehle Subject: Re: Software landmines (loops) Date: 1998/08/31 Message-ID: <6set0b$oa@sjx-ixn3.ix.netcom.com>#1/1 X-Deja-AN: 386524025 References: <6sbuod$fra$1@hirame.wwa.com> <35f51e53.48044143@news.erols.c Organization: ICGNetcom X-NETCOM-Date: Mon Aug 31 12:19:39 PM PDT 1998 Newsgroups: comp.lang.ada Date: 1998-08-31T12:19:39-07:00 List-Id: >In article , >Matthew Heaney wrote: >> >>I can almost live that. The real problem, however, is that using an >>extra flag to terminate VASTLY complicates the predicate. In fact, the >>flag doubles the number of states I have to think about when mentally >>evaluating the predicate! That's the real source of the loop >>termination errors. I recall a bunch of IV&V people coming to review a project a few years ago. They were the typical doctrinaire, fresh-out-of-school youngsters who one expects to find assigned by the big consulting companies, trained to look for "checkbox" violations rather than to think about the software process. One enthusiastic fellow began to insist that programmers remove all the exits from their loops -- convert them into while or for loops. It seems to me that the people who make up rules for programmers are people who either no long write real programs or never have written production code. The debate about exits within loops seems silly, particularly when talking about Ada. Nobody writes exits in Ada code unless the loop has a label, and the compiler tests to see if the exit contains the label of the loop as well as checking that the named loop has an "end label." This makes maintenance very easy. An exit is not another form of sphagetti code anymore than a return from within a procedure or function. In many algorithms there are perfectly good reasons for interrupting a flow of control early. Putting on a dogamtic face to deny that will simply result in more incomprehensible code. The talk about spaghetti code is colorful but unproductive. By this analogy, perhaps we should call the modular code, "ravioli code." Now we have this little plate of raviolis, each representing a software module. Oh, and then we could thread them together with one long strand of spaghetti. Yes, I do know what that implies. Richard Riehle richard@adaworks.com http://www.adaworks.com