× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



In my experience. nesting adds confusion. If I am nesting more than three deep then I sit back, relax, take my pulse, and look at what it is I am trying to do. Usually (not always!) I am making a logic process that can be greatly simplified in some fashion,or I am dealing with a process that belongs in a separate subroutine of its own.

Joe Pluta wrote:
James Lampert wrote:
Joe Pluta wrote:
Anybody who has ever pontificated about "self-documenting" code
should be 100% behind the %eof(file) syntax.
Very true. And unless you REALLY WANT the "last accessed" file, and it doesn't matter what that file is, it never hurts to qualify.

On another note, given that RPG doesn't give you indenting to show nesting level, I always use ENDIF/ENDDO/ENDSL rather than END, and frequently add comments to indicate which group I'm supposed to be ending.
This, to my mind, is one of the primary reasons to move to free-form. Nesting control sequences makes code much more readable.

Then again, at times, I have enough nesting levels active that if I draw nesting lines on a printout (and I find I rarely go through a week without having to analyze nesting at least once), I might go through five ink colors twice.
I try to avoid that these days. Between compound IF statements and the use of subroutines and/or subprocedures, I try to avoid more than four layers of nesting. It's not always possible, but it's something I strive for. I mean, unless you have one line per state, you're talking about many dozens of lines of code when you nest ten deep. I prefer to try and limit my procedures to a single visible page (about 40-50 lines). I realize that's an arbitrary limit and it could technically allow much deeper indentation, but again, I do my best to avoid it.

Joe

------------------------------------------------------------------------


No virus found in this incoming message.
Checked by AVG. Version: 8.0.134 / Virus Database: 270.4.4/1530 - Release Date: 7/2/2008 8:05 AM


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.