CONSTANTS lc_5000 type werks_d value ‘5000’? Whats wrong here?
Anything wrong with the below statement
CONSTANTS lc_5000 type werks_d value ‘5000’.
The compiler doesn’t complain – syntax checks are okay.
The code inspector doesn’t complain – as the following statements will use lc_5000 instead of ‘5000’.
Then what is wrong? Because the whole reason on why 5000 needs to be made a constant is lost.
The constant’s main purpose is readability and maintainability – neither of them are supported by a declaration like this.It is better off to hard code than to use a constant like this.
Readability – the person reading the code should understand what 5000 is , e.g. its plant in Atlanta. lc_5000 doesn’t say that.
Maintainability – Hypothetical situation, lets say before go-live , for some reason it was decided to rename plant Atlanta to 9000.
Then what should we do, a short cut like CONSTANTS lc_5000 type werks_d value ‘9000’. – most weird thing.
Or rename lc_5000 to lc_9000 and change all occurrences of lc_50000 – any advantage over hard coding?
The most ideal statement would be:
CONSTANTS lc_atlanta type werks_d value ‘5000’. This statement achieves both Readability and Maintainability.