Hi All,
Just wondering if anyone there has any documented coding standards for developing in Natural ?
Hi All,
Just wondering if anyone there has any documented coding standards for developing in Natural ?
I never defined coding standards, because they were already existant (and ignored by the programmers).
But I would say, the most important things are:
* Change history:
* 2006-07-18 Matthias added some new code <001 />
*
THIS IS SOME
OLD CODE
<001>
THIS IS
SOME NEW CODE
</001>
HERE COMES SOME
OLD CODE AGAIN
ONLY ONE LINE OF NEW CODE WAS INSERTED HERE /* <001 />
Less important (but good to think about) are standards like:
Matthias, it is very dangerous to answer such a question, as everybody has his/her own coding standards. And of course, these are the best standards in the world .
I have to disagree, too (because of maintenance experience) but also to agree:
[quote="Wilfried B
These are my standards for report programs (copied from another discussion…)
A useful arrangement for a Natural report program - organize the code somewhat the order it would be laid out on a page:
Some notes:
wrong:
1 #VAR1 (A15)
1 #VAR5 (A) DYNAMIC
1 #VAR3 (A1)
1 #VAR2 (A15)
1 #VAR4 (N4/1:12)
right:
/* map
1 #VAR1 (A15)
1 #VAR2 (A15)
1 #VAR3 (A1)
/* calculate
1 #VAR4 (N4/1:12)
/* workfile
1 #VAR5 (A) DYNAMIC
I sort them alphabetically and in a row. I also group them when they in similar use (one group for a map, one for calculating, one for workfiles etc.). It is easyer to read, in my opinion.
Hi,
I was searching the web for some reference materials for Natural coding standards and I found Documentation Set which includes:
in the following site [url]http://www.lava.net/~mhodges/[/url]:
The documents are in WordPerefct 5.1 format, whoever you can open it using WORD 2003. Hope this will be useful.
Abdullah
Hello Abdullah,
the link is not working correctly,
can you please point us to the right documents.
many thanks,
Karlheinz
I did a search for these docs, and believe I found them hosted on a different domain …
http://www2.hawaii.edu/~mhodges/index.html
But, based on the Last Updated date at the bottom of the page, and the recommendation to use Netscape Navigator 2.0 for best viewed, I’m not sure how up-to-date the content is.
Pete
Systems Analyst veteran
(Natural newbie)
As a Natural newbie you’ll want to read everything written about the language. The difficulty will be to determine which advice to embrace and which to ignore.
Years ago a User Group president collected and distributed a list of technical tips. For every tip that started with “always,” there was a contradictory tip that started with “never.” And, many tips have to do with personal preference. Just look at the previous posts in this thread.
The quality of such advice corresponds to the breadth and depth of experience of the author. A good place to start is the lists of presenters at the Natural Conferences, many of whom give their advice on the SAG-L listserver. Several more gurus subscribe to these forums, but you’ll determine for yourself who they are.
As a rule of thumb, good advice will start with “consider” and then explain the circumstances under which the tip should be followed or avoided.
And finally, consider the age of the advice. Does it apply to your version of Natural?
Golden rules I follow:
DONT USE:
DO USE:
Object Naming standards:
XXYYYYTN
Where:
XX = System prefix, eg TM
YYYY = code for object, eg UPDT
T = object type
P = PROGRAM
B = BATCH PROGRAM
M = MAP
F = FORM
N = SUBPROGRAM
S = EXTN SUBR
C = COPYCODE
J = JCL
T = TEXT
L = LDA
A = PDA
G = GDA
H = HELP RTN
etc
N = Number seq 0…9 A…Z
So our object is:
TMUPDTN1
[quote=“Matthias”]
A comment pointing when a if statement ends is a potential source of confusion if the code is changed.
Instead of using comments, use the command “struct display”. It shows the beggining and end of every if, for, repeat and define subroutine.
Response deleted - I should learn to check the posting’s date before responding!
I have yet to find anywhere that has managed to retain official Natural Coding standards for very long because coding standards tend to be very idiosyncratic.
For example I always have the label on the same line as the command (it irritates me beyond belief when the label is on it’s own line, because you have to put the breakpoint on the label not the command). I also HATE using special characters (such as <> ^ and but that is because many years ago these special characters were not printed correctly on chain printers causing me grief when trying to debug someone elses bad code (ie not my perfect code).
There is also the fact that Natural is a moving target, and each release could require new techniques that may be contrary to the current standards.