This is an old revision of the document!


Changes to Coding Convention and Refactoring Needs

Function naming capitalization for reserved words

As you are aware the Sahana functions contains special words that is used as automated callbacks by the Sahana front controller to delegate processing to the modules. Some examples are:

shn_mod_default()
shn_mod_mainmenu()
shn_xml_mod_default()

The problem is that new coders (and old ones with bad memories ;-) might not be able to differentiate the special names from the standard functions and use names that have special meaning. Thus it is a better convention to explicitly declare and differentiate special words from the rest (and it is neater IMO).

I would like to propose that we capitalize the special words of the function name as follows such that we are explicitly recognize that that certain reserved words of the function have special meaning and automated callback functionality.

old function name new function name
shn_mpr_default() shn_MPR_DEFAULT()
shn_dvr_mainmenu() shn_DVR_MAINMENU()
shn_xml_mpr_default() shn_XML_MPR_DEFAULT()

Navigation
  • Navigate