User Tools

Site Tools


coastalme_coding_standards

This is an old revision of the document!


CoastalME Coding Standards

These standards should be followed by all CoastalME developers.

Classes

Names

Class in CoastalME begin with C and are formed using CamelCase.

Examples:

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.1477244600.txt.gz · Last modified: 2016/10/23 13:43 by coastalmeadmin