Learn and improve

ERP customization is big investment, bad customization can cause stability issue and business disruption. Solution architect and developer should apply the best practices and do code review to catch any such code and improve upon. In this section, we will learn some best practices to be followed during development cycle

  • 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: Use consistent metadata names, variable, method names throughout the application. Follow standard code patterns. 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. 
  • Labels and text: Use labels for all text such as labels, form caption, info-log, and so on and provide code comments.
  • Database: The following list provides the best practices guidelines related to the database:
    • Avoid using direct SQL calls from the X++ code
    • Direct SQL statements do not respect application security
    • Consider specifying a field list in select statements to increase the performance
    • Use or create appropriate index  bases on select statements and queries
    • Use firstonly where applicable to increase the performance
    • Use aggregates in the selection criteria instead of letting the code do the aggregation
    • Use table joins instead of while loops
    • Use Update_Recordsetinsert_recordset, and delete_recordset wherever applicable
  • Exception handling: Use appropriate exception handling when dealing with transaction processing.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset