Difference between revisions of "Coding standards"

From TempusServa wiki
Jump to navigation Jump to search
Line 3: Line 3:
* Package name all lowercase
* Package name all lowercase
* General platform entities
* General platform entities
** Servlets: '''com.tsnocode.servlet'''
** Servlets: '''com.tsnocode.server.servlet'''
** Fields: '''com.tsnocode.field.TYPE'''
**Filters: '''com.tsnocode.server.filter'''
** Views: '''com.tsnocode.views'''
**Core: '''com.tsnocode.ui'''  
** Fields: '''com.tsnocode.ui.field.<group>'''
** Views: '''com.tsnocode.ui.views.<type>  (item,list,statistics,)'''
**Codeunit: '''com.tsnocode.codeunit.common'''
* Solution specific code
* Solution specific code
** TS customer app:  
** TS customer app:  
Line 30: Line 33:
** Escape all string parameters using DbConnection.EscapeSQL
** Escape all string parameters using DbConnection.EscapeSQL
** Prepared statements  
** Prepared statements  
* Page codeunits should contain user group restrictions
* All Page codeunits should contain some user group restrictions, and set to be default off


=== Review standards ===
=== Review standards ===

Revision as of 14:58, 25 November 2022

Naming standards (tobe)

Package / naming placement

  • Package name all lowercase
  • General platform entities
    • Servlets: com.tsnocode.server.servlet
    • Filters: com.tsnocode.server.filter
    • Core: com.tsnocode.ui
    • Fields: com.tsnocode.ui.field.<group>
    • Views: com.tsnocode.ui.views.<type> (item,list,statistics,)
    • Codeunit: com.tsnocode.codeunit.common
  • Solution specific code
    • TS customer app:
      • com.tsnocode.solution.app
      • com.tsnocode.solution.customer
      • com.tsnocode.solution.customer.app
    • Vendor app:
      • com.vendor.tsnocode.app
      • com.vendor.solution.app

Class naming

Naming convention follows Java standard

  • Starting with uppercase
  • No special characters
  • Seperate words with uppercase

In addition the following are recommended

  • CodeunitPage post fix name "Page"
  • CodeunitService post fix name "Service"
  • Shared ressources include "Helper"

Safety standards

  • Input sanitization used in SQL, using either
    • Escape all string parameters using DbConnection.EscapeSQL
    • Prepared statements
  • All Page codeunits should contain some user group restrictions, and set to be default off

Review standards

The following changes requires a formal code review

  • Changes to the API
  • Changes to common objects
    • Command
    • Security
    • Controller
    • DbConnection
  • Creation of OR changes to
    • Servlets
    • CodeunitPagePublic
    • Code containing SQL