User Tools

Site Tools


coastalme_coding_standards

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Last revision Both sides next revision
coastalme_coding_standards [2016/10/23 13:14]
coastalmeadmin
coastalme_coding_standards [2016/10/23 13:43]
coastalmeadmin
Line 5: Line 5:
  
 ===== Names ===== ===== Names =====
-Class in CoastalME begin with C and are formed using [[https://​en.wikipedia.org/​wiki/​Camel_case|camel case]].+Class in CoastalME begin with C and are formed using [[https://​en.wikipedia.org/​wiki/​Camel_case|CamelCase]].
  
 Examples: Examples:
Line 13: Line 13:
   * CCoastLanform   * CCoastLanform
   * [[http://​www.coastalme.org.uk/​doxygen/​html/​annotated.html|see all Classes here]]   * [[http://​www.coastalme.org.uk/​doxygen/​html/​annotated.html|see all Classes here]]
 +
 +
 +===== Members =====
 +
 +
 +Class member names begin with a lower case "​m_"​ followed by variable name using Hungarian notation. A variable name starts with a group of lower-case letters which are mnemonics for the type that variable, followed by whatever name the programmer has chosen; this last part is sometimes distinguished as the given name. The first character of the given name should be capitalized to separate it from the type indicators.
 +
 +Examples:
 +
 +  * m_bBasementElevSave:​ boolean "​b" ​
 +  * m_nXGridMax:​ integer "​n" ​
 +  * m_GDALWriteIntDataType:​ GDAL data type "​GDAL"​
 +  * m_lGDALMinCanWrite:​ long "​l"​
 +  * m_ulNumCells:​ unsigned long "​l"​
 +  * m_dCellSide:​ double "​d"​
 +  * m_ldGTotPotentialPlatformErosion:​ long double "​ld"​
 +  * m_strCMEDir:​ string "​str"​
 +  * m_tSysStartTime:​ time_t "​t"​
 +  *   
 +
 +An exception to this rule are ofstream type variables being the format of ofstream is VariableNAmeStream ​
 +
 +Examples of ofstream variables:
 +  * SedLoadTSStream
 +  * StillWaterLevelTSStream
 +  * ErosionTSStream
 +  * DepositionTSStream
 +  * SedLostTSStream
 +
 +All class members should be private. Public class members are STRONGLY discouraged
 +
 +===== Accessor Functions =====
 +
 +
 +Class member values should be obtained through accesssor functions. The function should be named without a get prefix. Accessor functions for the two private members above would be:
 +
 +  * bBeachErosionOrDepositionThisIter():​ function with a byte-value return code
 +  * 
 +===== Functions =====
 +
 +
 +Function names begin with a lowercase letter and are formed using mixed case. The function name should convey something about the purpose of the function.
 +
 +    updateMapExtent()
 +    setUserOptions()
  
  
coastalme_coding_standards.txt ยท Last modified: 2016/10/23 14:41 by coastalmeadmin