Skip to content

Robomongo Code Quality

Gökhan Simsek edited this page Aug 1, 2016 · 17 revisions

Robomongo Code Quality (Draft)

C/C++

1. Code Checks/Actions Before Commit

General

  • Keep things private as much as possible. (variables, functions etc..)
  • Use "const" a lot. Try to refactor "non-const" to "const" where possible (variables, functions, anything possible..)
  • Always initialize a variable with default value.
  • Make sure member variables are all initialized (uninitialized variables may have undefined values)

Resource Management

  • Use C++11 smart pointers (unique, shared, weak) instead of explicit(naked) new and delete.
  • Avoid using explicit (naked, non-RAII) new and delete. (strong memory leak candidate)
  • If "new & delete" must be used, wrap in ctor and dtor for automatic clean up (RAII).
  • Do not use smart pointers(owning ptrs) instead for purpose of raw pointers (T*).
  • Keep using raw pointers (T*) for non-owning pointers.

Concurrency

  • Do not pass pointer or reference to local variable or class member across different threads

...

2. Status Anlaysis Tool

...

3. Coding Guidelines

C++ Core Guidelines by Bjarne Stroustrup, Herb Sutter, July 28, 2016 https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md

...

4. References

C++ Core Guidelines by Bjarne Stroustrup, Herb Sutter, July 28, 2016 https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md

Scott Meyer's guideline-based books on C++ (http://www.aristeia.com/)

  • Effective Modern C++, Scott Meyers, 2014
  • Effective C++, Third Edition, 2005
  • Effective STL, 2001
  • More Effective C++, 1996

...