Coding Standards

General discussion about Design forms Builder
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1107: count(): Parameter must be an array or an object that implements Countable
PetrS
Site Admin
Posts: 181
Joined: 11 Jul 2014, 13:55
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1107: count(): Parameter must be an array or an object that implements Countable

Coding Standards

Postby PetrS » 16 Jul 2014, 06:48

size=150Coding Standards/size

There are proposals for Coding standards in SDF.
Feel free to comment it or add another rules.

ubRules division:/b/u
color=#FF0000A(utomatic)/color - This rules are keeped by SDF_builder automatically
color=#FF0000M(andatory)/color - This rules should be always used. Their use should be mandatory.
color=#FF0000H(ighly) R(ecommended)/color - This rules are important, but not mandatory.
color=#FF0000R(ecommended)/color - This rules are reccomended.


ub§1. The apperance of the source code/b/u
b§1.1. Syntax and formatting/b

u§1.1.1. Offset (A)/u
SDF doing offsets automatically

u§1.1.2. Braces (M)/u
First brace have to be at the end of line
Internal code block is deeper by tabulator (A)
Ending brace have to be solo on the new line. Only exception is IF - ELSE

example:
IF (...) {
code
} ELSE {
code
}
FOR (...) {
code
}

u§1.1.2.1. Braces in one row command (M)/u
Even if command is on one row, there is necessary to use 3 row notation

example:
IF (...) {
return false;
}

u§1.1.2.2. Bracers in Switch - Case (M)/u
This is just an application of above rules

example:
SWITCH (A) {
CASE 0: {
code
}
CASE 1: {
code
}
}

u§1.1.3. Every command have to be on separate row (M)/u
Semicolon mark or bracers have to be at the end of every row

example:
IF (...) {
return false;
}

u§1.1.4. Comments (M)/u
Comments should be in English.
If is necessary to use other language (czech, dutch), add author's mark (KRS, SLE...)
Also do not use diacritic.
Preffer use // for comments, instead of "/*comment*/"


u§1.1.4.1. Older parts of code as comment (HR)/u
Try to do not use comments on older parts of code. Code will become confused.
If the older code is necessary, add author's comment and mark.

u§1.1.4.2. Code comments/u
Code should be selfcommenting.
If necessary use comments for blocks, variables, cycles...

u§1.1.5. Pagebreak()(M)/u
Use Pagebreak() on the top and bottom of IMG command, so the picture can be deleted from MS word, if it is exported.
Always check the pagebreaks in brief output, where vizual components are in more columns. If pagebreak cut this, the whole code must be placed to the Block{}.(M)



ub§2. Translation/b/u
§2.2. How to divide texts
Separate mathematical formulas from text which should be translated. (M)
Do not use BR. (M)

§2.2. Removing string from translation
Remove all possible strings from translation by checkbox:
- mathematical forms in Text command
- symbols
- variable name which is used in Text command (M)
Attachments
B01 Geostatic stress advanced.CLS
(147.77 KiB) Downloaded 242 times
Ing. Petr Slepicka

Engineering calculations online - EuroCode, AISC, statics
Automate your static calculations today!

[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1107: count(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1107: count(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1107: count(): Parameter must be an array or an object that implements Countable

Return to “Design forms Builder”

Who is online

Users browsing this forum: No registered users and 11 guests