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







Maybe I'm just different.  It the past 23 years it hasn't been a problem in
my life and I've faced my share of complex programming situations.  What's
the problem with nested IF's as long as you don't go overboard?  Indent
your code, break complex things down into subroutines/subprocedures, use
descriptive variable names, comment well what's going on, and it shouldn't
be a big deal.  Basic stuff.  The problem may be when you have to maintain
someone else's code who didn't adhere to those guidelines.

I also don't think that lots of temporary variables are needed to
circumvent RETURN's.  That might tend to vary somewhat with what your code
is trying to accomplish.  Everybody has their own style.  If you only have
one RETURN per subroutine then I probably wouldn't fault you for it.


Dave Parnin
--
Nishikawa Standard Company
Topeka, IN  46571
daparnin@xxxxxxxxxxxxxx




                                                                                
                               
                      "Wilt, Charles"                                           
                               
                      <CWilt@xxxxxxxxxxx        To:       "RPG programming on 
the AS400 / iSeries"             
                      m>                         <rpg400-l@xxxxxxxxxxxx>        
                               
                      Sent by:                  cc:                             
                               
                      rpg400-l-bounces@m        Subject:  RE: No Subroutines 
(was Re: Debugging many           
                      idrange.com                subprocedures)                 
                               
                                                                                
                               
                                                                                
                               
                      07/28/2005 11:58                                          
                               
                      AM                                                        
                               
                      Please respond to                                         
                               
                      RPG programming on                                        
                               
                      the AS400 /                                               
                               
                      iSeries                                                   
                               
                                                                                
                               




Yeah, it was drilled into my head to...got the BS in CS to prove it.

But experience with some of the hoops I've coded to jump through in order
to have only one return has made me reconsider.

As a maintenance programmer, I'd much rather deal with multiple RETURNs
instead of nested IFs.

With a return it is obvious that the procedure ends right there given some
criteria.  With an if, you have to follow it through, look for a else and
see what else the procedure may be doing that is going to affect something.

As I mentioned in a prior post, my motto is "don't surprise me with a
return".  So you'll either see a single return, or "lots" of returns.  By
"lots", I mean that the code logically structured to use multiple returns.
Might only be two, but the extra won't be stuck in the middle someplace
where it would surprise you.

Charles Wilt
--
iSeries Systems Administrator / Developer
Mitsubishi Electric Automotive America
ph: 513-573-4343
fax: 513-398-1121


> -----Original Message-----
> From: rpg400-l-bounces@xxxxxxxxxxxx
> [mailto:rpg400-l-bounces@xxxxxxxxxxxx]On Behalf Of
> daparnin@xxxxxxxxxxxxxx
> Sent: Thursday, July 28, 2005 12:21 PM
> To: RPG programming on the AS400 / iSeries
> Subject: Re: No Subroutines (was Re: Debugging many subprocedures)
>
>
>
>
>
>
> Having multiple RETURN's is not good practice.  This was
> drilled into our
> heads back in the first year of college.  It was just like using
> GOTO's--you just don't do it because there are other
> constructs to handle
> it.  There is only one entry point into a
> procedure/subroutine and there
> should be only one exit point.  Having more than one adds potential
> confusion and detracts from readability.  It might be easier
> to code but it
> may not be easier for someone else to maintain years from
> now.  Just my
> $0.02.
>
> Dave Parnin
> --
> Nishikawa Standard Company
> Topeka, IN  46571
> daparnin@xxxxxxxxxxxxxx
>
>

--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
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 thread ...

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.