|
But for me, the fact that examples tend to be copied verbatim actually
reinforces my "strive for craftsmanship" mentality when I write them.
(This is in contrast to production code, which tends to be uglier but
hopefully more robust than examples.)
Since people are going to be copying verbatim, I worry that if I show them
action = 'Z';
coolAPI(action: data);
instead of simply
coolAPI('Z': data);
then when it comes time for them to try hooking it up to a dynamic
process, what they are going to write is
// Part of a loop that loads a new value into ACTCODE on each iteration:
action = actcode;
coolAPI(action: data);
instead of simply
coolAPI(actcode: data);
I mean, the extra step is not a crime. It's not even expensive. But I
don't really see what it gains, and I hate to encourage unnecessary
code.
Now, after saying all that, I timidly ask: What exactly was wrong with
the compile-time array example? I'll reproduce it here, since this is
a new thread:
Decades ago, there was a 'Teach yourself RPG' course; I can't remember
the company. They had an example of a compile time array that
traumatised me. They put the headings for a printed report in the
array. So the O-Specs were like
OQSYSPRT H 203 1P
O OR OF
O UDATE Y 10
O ARR,1 90
...
The reason this traumatised me isn't the example per se. It's the
fact that dozens; perhaps hundreds of RPG programmers took that
example as a way to do O-specs. I have personally witnessed this
pattern in thousands of programs, in multiple companies.
Let me back up. First of all, are you saying that they used the CT
array for the report title or for column headings? If the latter, then
was each heading its own array element, or were they glommed together
into one long element? And was ARR the actual name of the array?
What would have been a better way to write the O-specs?
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.