Re: Code problems with Perform Thru Exit causes fall through





"Rick Smith" <ricksmith@xxxxxxx> wrote in message
news:13ao1utdpul1cc@xxxxxxxxxxxxxxxxxxxxx

"Richard" <riplin@xxxxxxxxxxxx> wrote in message
news:1185663930.742550.293780@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On Jul 28, 3:42 pm, "Rick Smith" <ricksm...@xxxxxxx> wrote:

<snipped rehash of old debate ...:-)>

When sections are used as mini-programs, they have
a well-defined interface, thus all changes to the
mini-program are isolated from the rest of the code.
And, such mini-programs may be easier to re-use.

When sections are used in the same manner as
paragraphs, they do not necessarily have what may
qualify as an interface and the lack of isolation allows
for the same ad hoc coupling that may exit with
paragraphs only.


I was impressed with these two paragraphs.

The first one is something I do (did?) all the time. It is particularly
obvious when you use OO, although I hadn't thought about it in the terms
described.

I think the second paragraph may have identified why there is such divided
opinion over the use of SECTION. Many people see it in the same terms they
see a paragraph name. Those of us who have used it successfully for many
years (without being shot, or even frowned at, by people subsequently
required to maintain our code), do not use it in that fashion.

I have never used PERFORM XXX-SECTION THRU xx-EXIT and I never would. Using
SECTION makes the THRU redundant.

As for cutting and pasting bits of source code around a program, no I don't
do that either. If you need it in more than one place, put it in a SECTION
and PERFORM it (Or consider making it a called subprogram).

I think this second paragraph is an insightful comment on use of SECTIONS.
(Given that this topic has been thrashed to death here over the years, this
is the first time I have seen anything posted that gave a different insight
or actually added something of value.)

For myself, I was forced to move from PERFORM THRU (paragraph names) to
PERFORM [Section] when the standards in the place I was working at were
changed by a new chief programmer who liked SECTIONS. (This was around
1968). Very explicit rules were laid down about their use (no mixing
PERFORMs of paragraphs and sections in the same program, no use of THRU,
Sections being used to encapsulate specific functions, and so on. Most of us
were not happy with the change; people usually resist what they're not used
to, but within a few months most of us had got the "hang of it" and had no
problem with it. Since then I have always written SECTIONed code in COBOL
and it has never been a problem (for me, or for others who had to
subsequently maintain the code.)

Yes, it CAN be problematic (so can many COBOL constructs when used loosely)
but it can also be useful.

Why it is necessary to have a jihad over it or call for the shooting of
people who do it, is beyond me...:-) I have mantained code written by others
that used every kind of variation and I don't recall ever complaining about
it. That's what they paid me to do. I'm a professional programmer; give me
code that's broken and I'll fix it.(There was a time when I wasn't the only
one.... :-))

So often here I see people bleating about "ease of maintenance" when what
they really mean is "Write it the way I do, then it 's easy to maintain"...
They don't usually add the "...for me" that that particular sentence
actually requires.

Oh, did I mention I also maintained code that had ALTERs in it? Never had a
problem with that particular construct, either, and on early platforms where
we cared about bytes and performance, ALTER was an extremely efficient way
of implementing things like first time switches and managing overlays. I was
sorry to see it go, but the wimps won the day... :-)

I have become persuaded against GO TO over the years, but it really doesn't
bother me if others use it. After maintaining and managing spaghetti code
for years before Mr. Djikstra wrote his paper, I was pretty blase about it.

These days components rather than source code are more the focus of my
effort, so I really don't care about source code wars, or people
pontificating on what is "right" or "wrong" regarding technique, in a
near-obsolete programming language.

PL got it right when he says that what works is what matters.

Anyway, thanks to Rick, whose post shed some light on WHY this is a
sensitive topic.

Pete.

"I used to write COBOL...now I can do anything."


.



Relevant Pages

  • Re: Code problems with Perform Thru Exit causes fall through
    ... such mini-programs may be easier to re-use. ... paragraphs, they do not necessarily have what may ... qualify as an interface and the lack of isolation allows ...
    (comp.lang.cobol)
  • Re: Code problems with Perform Thru Exit causes fall through
    ... and without the EXIT SECTION. ... down a nested IF into small paragraphs. ... such mini-programs may be easier to re-use. ... self-imposed discipline that creates this alleged 'isolation' and lack ...
    (comp.lang.cobol)
  • Re: War: why everyone wishes it would stop but no one can stop it.
    ... follow instructions such as "look at the last few paragraphs." ... Had Engineer originally posted the salient paragraphs the first time rather ... War is "bad for the people but good for the governing class". ...
    (soc.religion.quaker)
  • Re: Judge Judge
    ... actually started with the second paragraph with the opening: ... Longer paragraphs were continued on the reverse. ... If it inspires me to write a tenth as well as Jane ... That's how I read it the first time. ...
    (alt.usage.english)
  • Re: Judge Judge
    ... actually started with the second paragraph with the opening: ... Longer paragraphs were continued on the reverse. ... If it inspires me to write a tenth as well as Jane ... That's how I read it the first time. ...
    (alt.usage.english)