Coding best practices
In this section, we will learn some best practices to be followed during development in Dynamics AX.
Best practice check
Run your code through the X++ best practices process, evaluate all the best practices errors and warnings, and take the appropriate action.
Naming variables and objects
Begin the variable and method names with lowercase letters like custTable
, validateFields
, and so on. Begin the names of the AOT elements with capital letters such as CustTable
, SalesFormLetters
, and so on.
Prefix the parameters names with an underscore (Args _args
). Use meaningful and self-explanatory variable names. For example: SalesTable salesTable
and not SalesTable table1
Commenting the code
Code comments enhance the readability of the code and are very useful for those involved in modifying or maintaining the code. Comments should be used to describe the intent, algorithmic overview, and the logical flow.
Add XML documentation for class, class methods, and table methods. You can generate...