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: 1108a1,9a0ff0bffdf63657 X-Google-Attributes: gid1108a1,public From: "Joe Chacko" Subject: spaghetti code(was Re: Software landmines (loops)) Date: 1998/09/11 Message-ID: <6tbsjs$i76$1@zen.hursley.ibm.com>#1/1 X-Deja-AN: 390202305 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> <35F252DD.5187538@earthlink.net> <6t4dge$t8u$1@nnrp1.dejanews.com> X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4 Organization: IBM UK Laboratories Ltd. Newsgroups: comp.lang.eiffel,comp.object,comp.software-eng,comp.lang.ada Date: 1998-09-11T00:00:00+00:00 List-Id: adam@irvine.com wrote in message <6t4dge$t8u$1@nnrp1.dejanews.com>... > Charles Hixson wrote: > > I suppose that it is possible to write spaghetti code without using > > goto's, I've never tried. > >Sigh . . . does anyone *try* to write spaghetti code? [snip] > but I do >know that I've *seen* plenty of convoluted code written by people brought up >in the "GOTO is evil" religion. Maybe it shouldn't be called "spaghetti >code" since the control doesn't wind up over itself; maybe "rotini code" is >more appropriate since although the different parts aren't entangled, they're >all completely twisted within themselves. I once saw a program written in Eiffel that simply used recursive procedure calls (exactly where he might have used GOTOs) as the main control structure. It was a text-based implementation of a patience (solitaire) card game, but without the game logic. At the end of a game you were given the option of another game. There wasn't a single procedure in the program that returned until you chose to exit the program (if there had been a few, the code would have been harder still to understand). I later discovered that the author of this code had written it this way to avoid this assignment answer (written for an associate) scoring more marks than (or being connected with) the one he had written to hand in under his own name. I suppose this is spaghetti code where somebody holds both ends of each strand to start with. Spaghetti coding on the byte (bight), as it were. Anyway, it is possible to write spaghetti code without using GOTO. In answer to Adam's (albeit rhetorical) question: yes, people do _try_ to write spaghetti code. Cheers, Joe. -- Joe Chacko Soft Engineer, Hursley Park, IBM UK Labs My employer buys my time, not my opinions.