I gave the impression that I never do anything like my COBOL example, but I
exaggerate. I do see the value of putting large chunks of code into a
procedure even if it's called only once -- named for example "ProcMain" --
in order to improve the readability of the program. I think someone else on
IBM-MAIN recently said the same thing; Gil, maybe? David Nicoll?
I sometimes do it in desperation, but mostly I avoid it, not because I think
it's a bad idea but sheerly out of habit. In my head, a subroutine is for
organizing code I execute more than once, even though I know about and
theoretically approve of this other purpose. Instead, I break my long
sequences into sections -- rarely more than eight or ten lines long -- that
I think of as "paragraphs", separated by blank lines and headed by one or
more explanatory comments. Sometimes the comments are pretty short; for
example I usually have one headed simply "/* Output. */" that reports on the
results I spent the rest of the time collecting.
But yeah, if for some reason I can't clearly express it all in commented
sections, I will as a last resort designate a subroutine. And when you and
others talk about it, I think "I gotta do that more often".
For multi-part variable names I use PascalCasing rather than camelCasing,
but otherwise I'm with you: I start out doing that for clarity, but if it's
a name I use a lot, sooner rather than later I get sloppy and stop doing it.
And for one-word variables and labels it's all lower case.
/* Cooking tip: If you cook your kale with a little coconut oil, it makes it
easier to scrape it into the garbage. -YS @NYinLS2121 */
-----Original Message-----
From: Arthur T. <
tsorexx....@XOXY.NET>
Sent: Sunday, June 27, 2021 22:53
COBOL was neither my first nor main language, nor do I love it. I would not
code like your example. But I do something vaguely similar.
I found that it was easier for me to understand some of my own programs if I
moved some of the setup stuff to a later routine I did, in fact, call
INITIALIZE. That way, the meat of the programming was right up front where
it was obvious.
I dislike using superfluous labels, so I wouldn't code all the
initialization and then be able to search for, say, "MainRoutine:", nor
would I expect someone else looking at my code to figure that out.
And (not counting spaghetti code), I try to modify programs as much as
possible in the style they were originally written. That way, the next
person coming in doesn't have to interpret a mishmash of styles to figure
out what the program is doing.
I will sometimes camel-case my variables so I can understand them. But, once
I've introduced them, I generally get lazy and use them as all lower case. I
generally capitalize my own labels to show me that they're my own, internal
routines on the calling statements. I don't want to learn a language where
variable abc is different from variable aBc, nor one where I have to
remember how some random programmer capitalized a library routine.
--- On 27 Jun 2021 12:52:21 -0700,
robhb...@GMAIL.COM (Bob Bridges)
wrote:
>Gil's post...on IBM-MAIN reminds me of something I see repeatedly, code