Learn and improve

ERP customization is a big investment, and bad customization can cause stability issues and business disruption. Solution architects and developers should apply best practices and do a code review to catch any such code and improve upon it. In this section, we will learn about some best practices to be followed during the 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, variable, and 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 elaborate on the intent, algorithmic overview, and logical flow. Add XML documentation for classes, 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 performance.
    • Use or create appropriate index bases on select statements and queries.
    • Use firstonly where applicable to increase performance.
    • Use aggregates in the selection criteria rather than letting the code do the aggregation.
    • Use table joins in place 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
3.149.214.32