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 X-Google-Thread: fac41,9a0ff0bffdf63657 X-Google-Attributes: gidfac41,public X-Google-Thread: f43e6,9a0ff0bffdf63657 X-Google-Attributes: gidf43e6,public X-Google-Thread: 1108a1,9a0ff0bffdf63657 X-Google-Attributes: gid1108a1,public From: Charles Hixson Subject: Re: Software landmines (loops) Date: 1998/09/06 Message-ID: <35F252DD.5187538@earthlink.net>#1/1 X-Deja-AN: 388365791 Content-Transfer-Encoding: 7bit References: <6rf59b$2ud$1@nnrp1.dejanews.com> <6rfra4$rul$1@nnrp1.dejanews.com> <35DBDD24.D003404D@calfp.co.uk> <6sbuod$fra$1@hirame.wwa.com> <904556531.666222@miso.it.uq.edu.au> <6sgror$je8$3@news.indigo.ie> <6sh3qn$9p2$1@hirame.wwa.com> <6simjo$jnh$1@hirame.wwa.com> <35eeea9b.2174586@news.erols.com> <6sjj7n$3rr$1@hirame.wwa.com> <35f055a5.1431187@news.erols.com> <6sjnlu$83l$1@hirame.wwa.com> <6skfs7$2s6$1@hirame.wwa.com> X-Posted-Path-Was: not-for-mail Content-Type: text/plain; charset=us-ascii X-ELN-Date: Sun Sep 6 02:13:17 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: Joe Gwinn wrote: > > It seems to me that there is an unspoken assumption in the long debate > about GOTOs and spaghetti code: It doesn't follow that presence of GOTOs > makes code spaghetti, or that code without GOTOs is always clear and easy > to understand, write, and maintain. > > The issues are in my experience quite independent. I have seen lots of > spaghetti code with nary a GOTO, and perfectly clear code with many GOTOs. > ... > Joe Gwinn I suppose that it is possible to write spaghetti code without using goto's, I've never tried. I do know that with goto's INSTEAD OF while, until, elsif, begin...end, etc. it was very difficult NOT to write spaghetti code, and since there was originally the theory said that the best code economized on the number of CPU cycles, rather than optimized intelligibility, there was every reason TO write code that took short-cuts. Actually, there was a second optimization which said that code should use the minimum amount of core memory, so sometimes instructions would modify other instructions, so that blocks of code wouldn't need to be repeated with only slight changes. Spaghetti code didn't mean multiple return statements to the same location in the first 10 lines of the routine. O my no. I used to use several different colors of pen so that I could keep track of which direction the flow of control was going on the current branch. And seven levels wasn't unusual. My usual code was blue for down, green for up, red for a branch to an error exit, and black for a format statement reference. I BELIEVE in structured programming. I'm just not sure that se/se actually captures what it's really about. And I'm sorry, but even if Dijkstra did invent it, I don't feel that he necessarily understood what he was inventing. So quotes about what he said strike me as beside the point. YES, it was VERY important for him to say it. YES, he made great improvements in the art of programming. YES, he is one of the founders of what modern programming IS. This doesn't make him perfect and omniscient and omnipotent. Early returns from routines frequently make them easier to understand. And maintain. Se/se is something that is worth moderate efforts. It is, however, related to something else. Something that I don't yet have words to wrap around, but lots of other people on this list seem to also feel it. Code should be easy to understand AND to maintain. Both need to be optimized. Somehow.