On 3/20/2018 7:07 PM, Dan wrote:
On Tue, Mar 20, 2018 at 6:49 PM, Charles Wilt <charles.wilt@xxxxxxxxx>
wrote:
lol...YES apparently isn't a constant...
Otherwise that wouldn't compile.
Obviously, that EVAL statement is a giveaway, but not if the code you're
trying to debug before you find that EVAL is:
IF S1_PAID = YES
"Why is this true when S1_PAID is 'N'?!?!?!?"
When I was a littler child, I crashed my sled into a tree. Broke my
nose. My nose works: I can breathe through it, but it's far from beautiful.
I've seen code like that.
I've written code like that.
Imagine RPG II that looks like this:
C 21N80 50
CANN12NMR GOTO SKIP1
This was common in the 70s.
Then I come along in the 80s and I need to modify it on my
fancy-schmancy S/38. I don't have 128 character names yet; I don't even
have mixed case yet. But I'm a genius (aren't all teens?) and in my
youthful 'wisdom' I decide to turn that complex indicator mess to a
clearer code block:
C* Do we process this customer's order or hold it?
C* Yes, we process it unless the customer fails one or more conditions
C MOVEL 'Y' YES 1
C* On credit hold
C IF condition1
C MOVEL 'N' YES
C ENDIF
C* On supervisor hold
C IF condition2
C MOVEL 'N' YES
C ENDIF
C* You get the picture
C IF YES = 'Y'
C EXSR PRCORD
C ENDIF
Yes (hehe) in retrospect, the name I chose was... hm. It didn't occur
to me that some future me would think of YES as a /constant/. Probably
because such things didn't exist on my fancy-schmancy S/38. I'll cut my
much younger self some slack for not predicting that development, but
no, that's not a good name - even with 6 or 8 character limitations.
Well, that unbeautiful code worked day in and day out for 30 years, and
someone's in there making changes to it (again) and they aren't keen on
the readability factor (as this generation rightly experiences it). Is
there anything that can be done to make it better as in more
readable/comprehensible?
RDi has a Refactor > Rename capability that will let the current
programmer rename that YES into something more useful like
allowOrderToProcess. Between Refactor > Rename and Convert Selection to
Free-form, it shouldn't be too difficult to alter the code to become
more readable without altering the functionality.
Maybe it's time for some cosmetic surgery...
As an Amazon Associate we earn from qualifying purchases.