× 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.



<snip>
Actually, in my opinion, it's the local variables that make code more
bug-prone. Why on earth do I need to keep track of what the variable
is in this or that procedure, anyway?

If there is really that much "keeping track" involved, then you're
probably doing it wrong. Either the parameters aren't named well, or
the procedures are doing too much, and should be broken into smaller
pieces.
</snip>

Very true. If you are having problems with a lot of variables in a
sub-procedure, the procedure is doing too much.

You should be able to describe what a sub-procedure does without using
conjunctive verbs (And Or).

<snip>
If a local variable name in a subprocedure is also in the main
procedure, I
still say it leads to confusion, especially if nobody bothers to explain
to
a new programmer (or an old one coming over from RPG III), that these
two
are actually different variables.
</snip>

I have ran into this problem also and the way I deal with it today is to
always name any global variable to start with a "g_" so g_Anchor,
g_Tail, etc. Just saves a lot of hassles.

This goal of any ILE program should be to have zero global variables so
what you do have in terms of global variables should be very small and
identified as global.

One of the classic signals of a monolith program is looking in the
global "D" specs and seeing a ton of variables declared.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.