Sections, Paragraphs, and related topics
From: William M. Klein (wmklein_at_nospam.netcom.com)
Date: 12/06/04
- Next message: William M. Klein: "Re: Infinite Loops and Explicit Exits"
- Previous message: Robert Wagner: "Re: Infinite Loops and Explicit Exits"
- Next in thread: LX-i: "Re: Sections, Paragraphs, and related topics"
- Reply: LX-i: "Re: Sections, Paragraphs, and related topics"
- Reply: steve.t: "Re: Sections, Paragraphs, and related topics"
- Reply: Lueko Willms: "Re: Sections, Paragraphs, and related topics"
- Reply: Howard Brazee: "Re: Sections, Paragraphs, and related topics"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 06 Dec 2004 22:48:46 GMT
Just as a new thread, I wanted to post my observations and thoughts on this
(most previously posted).
1) It is my impression that the use of (all) SECTIONS is more common in Europe
and the use of (all) PARAGRAPHS is more common in the US. (I don't know about
Asia or Pacific or India or Canada, etc). This observation comes from my time
working at Micro Focus (and dealing with customers in both regions.)
2) It is my perception that having ALL "Sections" (possibly with a single
paragraph and/or exit paragraph) *OR* having all PARAGRAPHS is each an "equally
maintainable" style (and not error prone). While having a MIXTURE of the two is
not a "good idea" (IMHO).
3) Having numbers as the prefix of EITHER paragraphs or sections is ENTIRELY a
"style" issue and never (or rarely?) causes any maintainability or enhancement
problems. It is USEFUL with some editors (e.g. ISPF) and not useful with
others. (I have yet to see any cases where numbered procedures are "bad" - but
I can see why - in some environments - they would be useless.). I do know that
in "large IBM mainframe shops" where I have seen it used consistently (with
"normal" ranges for various functions) it can make "picking up" someone else's
code easier to understand or fix quickly. However, this is probably true for
ANY "structure" technique that is used consistently within a large shop.
4) Having a SECTION with multiple (other than just an -EXIT) paragraph within
OR
Having multiple PARAGRAPHS (other than an -EXIT) in a PERFORM range
is equally error-prone.
5) Some (possibly many) sites that "traditionally" have PERFORM xxxx THRU
xxxx-EXIT standards *also* have software (or at least procedures) to insure that
NO paragraph header appears between "xxxx" and "xxxx-EXIT".
6) Using the PERFORM xxxx THRU xxxx-EXIT technique (or using the SECTION with
an -EXIT procedure) provides the functionality that is provided as an extension
to the '85 Standard or in the '02 Standard of doing an "immediate exit" from
within a procedure (i.e EXIT PARAGRAPH/SECTION). Although it is POSSIBLE to
avoid this technique with switches and/or deeply nested conditionals, I think
that the ability to "exit immediately under some logic situations" is a useful
tool in COBOL. Furthermore, (IMHO) this ability outweighs any potential problems
of PERFORM ... THRU - when sufficient safeguards are in effect to avoid other
types of GO TO and/or middle-of-the range paragraph names. (I personally prefer
EXIT PARAGRAPH - as it avoids "potentially error-prone" labels - but accept
that it is not generally available.)
7) Just as a "side-note" I usually PERFORM rather than GO TO a "kill/stop the
application" procedure (such as an ABEND or EXEC CICS RETURN paragraph). I know
this isn't ever going to come back, but it is easier to insure that my
applications do NOT include any "bad" GO TO's.
8) Just as there is debate about how to "modify" OO properties (see separate
thread), there is also "debate" as to whether doing a "downward" GO TO within a
single procedure is or is not "structured" code. It *does* maintain the "single
entry / single exit" rule - but also DOES a "go to label" statement. If your
view of structured coding does NOT allow this structure *and* you feel that
following "strict structured coding" philosophy is important, then don't use it.
-- Bill Klein wmklein <at> ix.netcom.com
- Next message: William M. Klein: "Re: Infinite Loops and Explicit Exits"
- Previous message: Robert Wagner: "Re: Infinite Loops and Explicit Exits"
- Next in thread: LX-i: "Re: Sections, Paragraphs, and related topics"
- Reply: LX-i: "Re: Sections, Paragraphs, and related topics"
- Reply: steve.t: "Re: Sections, Paragraphs, and related topics"
- Reply: Lueko Willms: "Re: Sections, Paragraphs, and related topics"
- Reply: Howard Brazee: "Re: Sections, Paragraphs, and related topics"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|