Skip to main content

[archive] acceptable coding practice

  • June 16, 2010
  • 3 replies
  • 0 views

[Migrated content. Thread originally posted on 15 June 2010]

We are using acubench to develop. Currently we are converting a char system to gui and several of our programs have different windows depending upon linkage, sometimes they open no windows at all, and just do some processing if called. I was wondering if this was acceptable coding practice to handle these type of scenarios.


Before Program.
EVALUATE LNK-VAR
    WHEN 1 PERFORM SOME ROUTINE
               GOBACK  | Or should be be doing a PERFORM Acu-Exit-Rtn ?
    WHEN 9 PERFORM SOME OTHER ROUTINE
               GOBACK
END-EVALUATE.

MAIN-Bef-Create.
EVALUATE LNK-VAR
    WHEN 2 PERFORM Acu-OTHERWIN-Routine
               PERFORM Acu-Exit-Rtn
    WHEN 3 PERFORM Acu-EXTRAWIN-Routine
               PERFORM Acu-Exit-Rtn
END-EVALUATE. 

Code continues for MAIN WINDOW


Or maybe we should just be splitting these type of programs in to several separate Programs. Any thoughts?

Thanks for any insights.

3 replies

[Migrated content. Thread originally posted on 15 June 2010]

We are using acubench to develop. Currently we are converting a char system to gui and several of our programs have different windows depending upon linkage, sometimes they open no windows at all, and just do some processing if called. I was wondering if this was acceptable coding practice to handle these type of scenarios.


Before Program.
EVALUATE LNK-VAR
    WHEN 1 PERFORM SOME ROUTINE
               GOBACK  | Or should be be doing a PERFORM Acu-Exit-Rtn ?
    WHEN 9 PERFORM SOME OTHER ROUTINE
               GOBACK
END-EVALUATE.

MAIN-Bef-Create.
EVALUATE LNK-VAR
    WHEN 2 PERFORM Acu-OTHERWIN-Routine
               PERFORM Acu-Exit-Rtn
    WHEN 3 PERFORM Acu-EXTRAWIN-Routine
               PERFORM Acu-Exit-Rtn
END-EVALUATE. 

Code continues for MAIN WINDOW


Or maybe we should just be splitting these type of programs in to several separate Programs. Any thoughts?

Thanks for any insights.
Both look fine, one gets executed before the program, one gets executed before the Window is about to be displayed, whichever model works best for you.

[Migrated content. Thread originally posted on 15 June 2010]

We are using acubench to develop. Currently we are converting a char system to gui and several of our programs have different windows depending upon linkage, sometimes they open no windows at all, and just do some processing if called. I was wondering if this was acceptable coding practice to handle these type of scenarios.


Before Program.
EVALUATE LNK-VAR
    WHEN 1 PERFORM SOME ROUTINE
               GOBACK  | Or should be be doing a PERFORM Acu-Exit-Rtn ?
    WHEN 9 PERFORM SOME OTHER ROUTINE
               GOBACK
END-EVALUATE.

MAIN-Bef-Create.
EVALUATE LNK-VAR
    WHEN 2 PERFORM Acu-OTHERWIN-Routine
               PERFORM Acu-Exit-Rtn
    WHEN 3 PERFORM Acu-EXTRAWIN-Routine
               PERFORM Acu-Exit-Rtn
END-EVALUATE. 

Code continues for MAIN WINDOW


Or maybe we should just be splitting these type of programs in to several separate Programs. Any thoughts?

Thanks for any insights.
Just don't allow 2 "accepts" to be running at the same time
If you have done say "PERFORM Acu-Screen1-Routine" and in here the user clicks a button which triggers an event then you must terminate the current accept before intiating another.

Hopefully that makes sense.

[Migrated content. Thread originally posted on 15 June 2010]

We are using acubench to develop. Currently we are converting a char system to gui and several of our programs have different windows depending upon linkage, sometimes they open no windows at all, and just do some processing if called. I was wondering if this was acceptable coding practice to handle these type of scenarios.


Before Program.
EVALUATE LNK-VAR
    WHEN 1 PERFORM SOME ROUTINE
               GOBACK  | Or should be be doing a PERFORM Acu-Exit-Rtn ?
    WHEN 9 PERFORM SOME OTHER ROUTINE
               GOBACK
END-EVALUATE.

MAIN-Bef-Create.
EVALUATE LNK-VAR
    WHEN 2 PERFORM Acu-OTHERWIN-Routine
               PERFORM Acu-Exit-Rtn
    WHEN 3 PERFORM Acu-EXTRAWIN-Routine
               PERFORM Acu-Exit-Rtn
END-EVALUATE. 

Code continues for MAIN WINDOW


Or maybe we should just be splitting these type of programs in to several separate Programs. Any thoughts?

Thanks for any insights.
Thanks for the input guys, I think with some of the programs we have decided to spilt them into separate programs... others that are not very complex we will be using this sort of solution, I guess we will see how it goes...