Skip to content

Programming Specification

jwillow19 edited this page Jul 13, 2021 · 1 revision

Programming Specifications and Standards

Ensure your code is up to par with the programming specification and standards for your contribution to be integrated seamlessly.

  • C++ programming complies with the Google C++ Coding Guidelines. Unit testing (UT) complies with the Googletest Primer.

  • Python programming complies with the Python PEP 8 Coding Style. Unit testing (UT) complies with the pytest framework.

Remarks

  • Use the string data type preferentially. Avoid the use of the char* data type.
  • Do not use printf. Instead, use cout.
  • Use smart pointers for memory management.
  • Do not call exit in functions.
  • Do not use tools such as an IDE to automatically generate code.
  • Minimize third-party library dependencies. If a third-party dependency is imported, the installation and usage description must be provided.
  • Use English comments with a comment rate within 30%–40%. Self-commenting is encouraged.
  • Provide comments in the function header to describe the function purpose, input parameters, and output parameters.
  • Provide unified error codes to facilitate error locating.
  • Avoid printing error-level logs that have no impact on the system.
  • Remove commented useless code lines. The purpose of comments shall not be removing useless code lines.