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: 103376,4b06f8f15f01a568 X-Google-Attributes: gid103376,public X-Google-Thread: f43e6,9a0ff0bffdf63657 X-Google-Attributes: gidf43e6,public X-Google-Thread: 109fba,9536f6d30d365d8a X-Google-Attributes: gid109fba,public X-Google-Thread: 1108a1,9a0ff0bffdf63657 X-Google-Attributes: gid1108a1,public From: jdege@jdege.visi.com (Jeffrey C. Dege) Subject: Re: Software landmines (loops) Date: 1998/09/06 Message-ID: #1/1 X-Deja-AN: 388510474 References: <904556531.666222@miso.it.uq.edu.au> <6sgror$je8$3@news.indigo.ie> <6sh3qn$9p2$1@hirame.wwa.com> <6shbca$66c$1@news.indigo.ie> <6shhq7$lut$1@hirame.wwa.com> <6sjbso$1lk$2@news.indigo.ie> <6sjijg$36r$1@hirame.wwa.com> <6skhcm$1dr$2@news.indigo.ie> <35F0B5B0.8E2D0166@s054.aone.net.au> <905071271.568311@optional.cts.com> X-Complaints-To: abuse@visi.com X-Trace: ptah.visi.com 905121118 209.98.6.59 (Sun, 06 Sep 1998 17:31:58 CDT) NNTP-Posting-Date: Sun, 06 Sep 1998 17:31:58 CDT Newsgroups: comp.lang.eiffel,comp.object,comp.software-eng,comp.lang.ada,comp.lang.c++ Date: 1998-09-06T00:00:00+00:00 List-Id: On Sun, 06 Sep 1998 21:44:00 GMT, Ell wrote: >In comp.object Will Rose wrote: > >: "The remaining part of this monograph will be mainly an exploration of >: what program structure can be used to good advantage. In what follows >: it will become apparent that program correctness is not my only concern, >: program adaptability or manageability will be another. This stress on >: program manageability is my deliberate choice, a choice that, therefore, >: ..." > >Yes *this* is the overall *spirit* we should be working in. And quite >often restricting a loop, or procedure to se/se makes things less >maintainable in the judgement of a plurality or majority of project >programmers. I absolutely agree. In fact, so do most of the software engineering texts I've seen. Stephen Schach, who provided the definition of of structured programming that I quoted in an earlier post, explicitly recommends that the classical definition be loosened enough to allow breaks and gotos in the forward direction, particularly as a method of handling exceptional errors. >Multiple exits to enhance maintenance can work while preserving the >ability to prove program correctness. This happens if multiple exits >exist in a program which uses procedure calls and returns to calling >procedures 99.5% of the time as I see it. I've heard people talk about how breaks and multiple returns confuse code, and I'll have to admit, if a function or loop is lengthy, it can difficult to identify embedded returns or breaks. In these longer constructs, enforcing se/se makes them clearer. In a fairly short function or a short loop, identifying multiple returns or breaks is quite easy. So we might say that it is perfectly OK to use multiple returns in a short function or loop. But I think that's the wrong answer, entirely. We should say that it's _not_ OK to have long functions or loops. Breaking from the middle of a 20-line loop is perfectly understandable. Breaking from the middle of a 400-line loop is not. The answer is not to never break from a 400-line loop, but rather not to have 400-line loops. -- When cryptography is outlawed, bayl bhgynjf jvyy unir cevinpl.