Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: Notesfiles $Revision: 1.7.0.10 $; site ccvaxa Path: utzoo!watmath!clyde!cbosgd!ihnp4!inuxc!pur-ee!uiucdcs!ccvaxa!aglew From: aglew@ccvaxa.UUCP Newsgroups: net.lang Subject: Re: and if you put this in your languag Message-ID: <800010@ccvaxa> Date: Thu, 27-Mar-86 00:03:00 EST Article-I.D.: ccvaxa.800010 Posted: Thu Mar 27 00:03:00 1986 Date-Received: Sat, 29-Mar-86 01:10:41 EST References: <1187@mmintl.UUCP> Lines: 38 Nf-ID: #R:mmintl.UUCP:1187:ccvaxa:800010:000:1672 Nf-From: ccvaxa.UUCP!aglew Mar 26 23:03:00 1986 Talking about the IFs that want to merge different paths back together, g-rh@cca.UUCP writes: > I went on to outline a schematic suggestion for using flags and >Jem wasn't happy with that. Frankly, I'm not enthusiastic about flags >either. The real difficulty is that there is not good solution to the >problem which can be roughly stated as follows: Given a net of if-then-else >logic in which a functional block of code occurs more than once, how do >you structure the code? Some possible solutions are: > >(a) Duplicate the block >(b) Replace the block by a procedure >(c) Replace the block by a macro >(d) Separate the logic structure and the executable structure, > using flags to control the execution >(e) Programming tricks based on language syntax To these we can also add (f) using GOTOs if the paths of execution converge. A side comment drawn from kolstad@convex.UUCP on net.cse >Style: I graded the first two assignments and inserted style >suggestions -- the students were horrified that I would eliminate 7 >boolean variables and if statements in favor of a single >forward-escaping goto. They heard that no one did that! Oh well. >Most students used PASCAL; two or three used C. Some did get better >stylistically; some did not. GOTOs are not EVIL; they are a tool that can be used in structured programming just as any other tool. They are a tool that is frequently misused, sufficiently so that you should always think three times before using a GOTO, (just like you should always think twice before using a gun, but sometimes you may have to) but sometimes they are the best thing to do. structured programming != GOTOless programming.