|
Well said... -----Original Message----- From: rpg400-l-admin@midrange.com [mailto:rpg400-l-admin@midrange.com]On Behalf Of Andrew Borts Sent: Thursday, December 06, 2001 10:26 AM To: rpg400-l@midrange.com Subject: RE: Why is LEAVE bad? (was: Cycle Processing vs. Doing it my way) To write 10,000 lines of code to avoid a goto/leave/iter/leavsr verses putting a leave in place to pop out of a loop, go to the top of a loop, or leaving a subroutine is a little pointless. One line of code to avoid those hassles. At the same time, I approached a person with a programming problem 6 years ago - I would have had to re-write the logic of the program, the client said simply "why not put a goto from there to there" - 2 lines of code, and 10 minutes later I was done. As far as cycle verses putting the logic in yourself - I maintain - "it depends" Read's verses reade are a same argument. If you Setll then read and check the "level" yourself, the system buffers chunks of data for that are read. Reade positions every time. Using the cycle probably buffers like mad since it can spin through the data. 20 lines of code later, and you can convert the world with a cycle program. Oh and so everyone knows, I'm 35, and in the industry since I'm 23 (12 years!) (since it's reveal how old you are and how long your in the industry week on RPG-L) Andrew Borts / Webmaster Seta Corporation 6400 East Rogers Circle Boca Raton, FL 33499 E-mail: Andrewb@setacorporation.com Corporate web site http://www.setacorporation.com E-Commerce web site http://www.palmbeachjewelry.com http://www.myfreeitems.com Voice: 561-994-2660 Ext. 2211 / Fax: 561-997-0774 -----Original Message----- From: Buck Calabro [mailto:Buck.Calabro@commsoft.net] Sent: Thursday, December 06, 2001 9:47 AM To: rpg400-l@midrange.com Subject: Why is LEAVE bad? (was: Cycle Processing vs. Doing it my way) >And what is wrong with LEAVE? It hardly >creates spaghetti code as the program flow >is always in the one direction. I like to refer >to a LEAVE as a structured GOTO!!!!! >From a readability point of view, having multiple exit points means that you must visually scan every line of code in the routine to see where and when it can pop out. This is in contrast to a routine that sets a return code and ONLY leaves from the bottom. You don't need to scan the entire routine to see where you come out because there's only one exit point. Having said that, I personally use LEAVE and ITER; especially in validity checking routines where the alternatives are worse. But in my vanity, I like to believe that I _think_ about the alternatives before automatically settling on GOTO and relatives. --buck "To find fault is easy; to do better may be difficult" --Plutarch _______________________________________________ This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@midrange.com To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l or email: RPG400-L-request@midrange.com Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l. _______________________________________________ This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@midrange.com To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l or email: RPG400-L-request@midrange.com Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.