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: fac41,9a0ff0bffdf63657 X-Google-Attributes: gidfac41,public X-Google-Thread: f43e6,9a0ff0bffdf63657 X-Google-Attributes: gidf43e6,public X-Google-Thread: 103376,4b06f8f15f01a568 X-Google-Attributes: gid103376,public X-Google-Thread: 1108a1,9a0ff0bffdf63657 X-Google-Attributes: gid1108a1,public From: behrends@cse.msu.edu (Reimer Behrends) Subject: Re: Software landmines (loops) Date: 1998/10/11 Message-ID: #1/1 X-Deja-AN: 399836854 References: <35cb8058.645630787@news.ne.mediaone.net> <1dg8p3r.vfredh1aou58iN@n207167116191.inetworld.net> <6v2nr9$t8l$1@hirame.wwa.com> <1dgane6.16owv2g7g8ov8N@u2n207167116151.inetworld.net> <1dge7py.7401x8z7ne24N@u2n207167116162.inetworld.net> <1dghyt5.oik1lzhxzf2N@n207167116176.inetworld.net> Organization: Michigan State University Newsgroups: comp.lang.eiffel,comp.object,comp.software-eng,comp.lang.ada Date: 1998-10-11T00:00:00+00:00 List-Id: Charles H. Sampson (claveman@inetworld.net) wrote: > Reimer Behrends wrote: [...] > > The loop body is of course the following part of the code: > > > > > > exit > > > > > > It has an exit at the "exit" statement, and one at the end of > part>, where control flow leaves the body to reenter at the top. And > > I'm not kidding you. Try to put the loop body into a procedure of its > > own, and this becomes very visible. (Ease of procedural decomposition is > > usually one of the benefits of strict single-entry, single-exit > > structures.) > > O. k., I might grudgingly grant you a half score on that one. You > pretty clearly said "loop body", but I was so fixed on "loop" that I > didn't notice that you had changed the frame of reference. Hmm. I was under the impression that I had phrased my reply with sufficient precision to not confuse the non-casual reader. My apologies if this wasn't the case. In any event, I didn't intend to "score". I just wished to point out an aspect that had apparently been overlooked in the discussion. [...] > Furthermore, it's not clear why that transfer of control is consid- > ered an exit from the loop body. Prior to the transfer a statement of > the body is executing. After the transfer a statement of the body is > executing. Where is the exit part? I have very little interest in abstractly discussing whether any particular control structure can be construed as having a single entry and/or single exit. Rather, there are certain advantages commonly associated with classical single-entry/single-exit control structures (ease of decomposition, clear control flow, etc.). I am arguing that these advantages are not present in a mid-exit loop, no matter whether you can technically say that a mid-exit loop has a single exit, and I was pointing out the reason why. [...] > Without thinking about it too hard, I'll grant your claim about > ease of decomposition. I don't want to think too hard about it because > I have the strong impression that this is another "who cares?" issue. > In my entire career I have rarely written the following construct: > > > > end loop > > Actually, I can't remember ever doing it, but I assume that I must have > at least a few times. I am perfectly aware that using abstractions on a regular basis is not a popular notion; mostly, I think, because some people still believe that using a procedure/class/etc. instead of inserting code directly will invariably slow their code down to a crawl. Of course, they tend to forgot about things like maintenance cost. Personally, I am pretty sick of code that spans several pages without any apparent benefit. [...] Reimer Behrends