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: 1108a1,9a0ff0bffdf63657 X-Google-Attributes: gid1108a1,public X-Google-Thread: 103376,4b06f8f15f01a568 X-Google-Attributes: gid103376,public X-Google-Thread: f43e6,9a0ff0bffdf63657 X-Google-Attributes: gidf43e6,public X-Google-Thread: fac41,9a0ff0bffdf63657 X-Google-Attributes: gidfac41,public From: Charles Hixson Subject: Re: Software landmines (loops) Date: 1998/09/06 Message-ID: <35F246E3.4424EF94@earthlink.net>#1/1 X-Deja-AN: 388358639 Content-Transfer-Encoding: 7bit References: <35f23ce2.7649859@news.erols.com> <6snn1b$c90$1@hirame.wwa.com> <35ef7dff.24318728@news.erols.com> <35f79e53.98130474@news.erols.com> <6ssb20$c99$1@hirame.wwa.com> <35F1BB50.C57557E1@s054.aone.net.au> <6ssnp6$hv3$1@hirame.wwa.com> <35F20EA6.A0F7EFB8@s054.aone.net.au> X-Posted-Path-Was: not-for-mail Content-Type: text/plain; charset=us-ascii X-ELN-Date: Sun Sep 6 01:22:07 1998 Organization: Mandala Fluteworks Mime-Version: 1.0 Newsgroups: comp.lang.eiffel,comp.object,comp.software-eng,comp.lang.ada Date: 1998-09-06T00:00:00+00:00 List-Id: I find myself not understanding the basis of this discussion. To me it seems reasonable to ask, "Do reasonable experts in the field consider that loops that exit in the middle are a part of structured programming". The answer, obviously, is: This is not a matter of total agreement. There have been agruments that say: If you have to repeat blocks of code, then you are violating the principles of structured programming. There have been statements made that: "Loops should be single entry/single exit" (so that program correctness can be proved?). These are both valid points. But if the same code can be topologically transformed from one form to another without altering it's deep flow of control (e.g., pull all of the code within isolatable blocks into a function call, and then call it, and accept a returned value. Then we can say while (the) ... if (the) gostack := distimms (the, doshes,"."); loop testing a flag each time throught the loop. When is it true? That's hard to say without examining the code in detail (which I haven't invented). Is this really any different from: while (the) ... exit when (\the); gostack := distimms (the, doshes,"."); loop But this identity is only obvious because the huge chunk of code has been factored out into the distimms routine. In fact when we look at this, we can see that it is also equivalent to: if (the) { beginloop ... exit when (\the); gostack := distimms (the, doshes,"."); endloop } If these are all equivalent, does it really make sense to say that one of them is structured and another isn't. Consider a further pair of transforms: if (the) { when (firstPartOfTheLoop (the) ) { if (the) gostack := distimms (the, doshes, "."); } } and if (the) { when (the) { flag := firstPartOfTheLoop (the); if (the) gostack := distimms (the, doshes, "."); } flag := firstPartOfTheLoop (the); } Now, I obviously haven't checked these with a compiler, but baring typos I think that is is obvious that these pieces of code are all isomorphic, so it seems TO ME unreasonable to claim that some of them are structured and others of them aren't. I would like to hear about why others would find it reasonable.