2015 m. birželio 17 d., trečiadienis

AX Source Code Quality: Top 10 X++ Coding Commandments 1.1

Hello AX Word,

This time I came up with an idea to list top 10 coding guidelines. We would all write a better code if we followed them.

      0. You shall check your code for best practices.
  1. You shall use a proper case for X++ code: start variables, functions, keywords with a lower letter; start application elements with a capital letter.
  2. You shall indent you code appropriately.
  3. You shall add curly brackets around every if, else, loop, switch (except case) and while select statement.
  4. You shall use meaningful names of variables, functions and application elements.
  5. You shall add a single spaces around operators, after commas, if, switch, case, loop keywords.
  6. You shall not use spaces before function parentheses, case's semi-column, ++ and -- operator, after ! (exclamation mark).
  7. You shall avoid using hard-coded values, especially for interface texts.
  8. You shall breakdown long statements.
  9. You shall use column style alignment.
  10. You shall cleanup unused code.
The list is subject to change if I get a more valuable best practice than one above. So this was named 1.0 :)

P.S. I wonder if there is beautifier tool somewhere in the market?

Be aware and take care!


2 komentarai:

  1. I guess I would add
    0. You shall compile with best practice checks
    because some of these commandments ... sorry, guidelines are cought by best practice checks.
    A code beautifier would be sweet indeed.

    AtsakytiPanaikinti
  2. Good point regarding best practices, Florain :)

    AtsakytiPanaikinti