web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Dynamics 365 Community / Blogs / ELandAX blog / AX Source Code Quality: Top...

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

Evaldas Profile Picture Evaldas 1,800
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.
  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, else, 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!



This was originally posted here.

Comments

*This post is locked for comments