Coding conventions for the MongoDB C++ code...
For anything not mentioned here, default to google c++ style guide
Git Committing and Pushing
- commit messages should have the case in the message SERVER-XXX
- commit messages should be descriptive enough that a glance can tell the basics
- commits should only include 1 thought.
- do NOT push until running the test suite
User Facing Conventions
 | These are very important as we can't change them easily – Much more than code conventions! |
Anything users see – command line options, command names, command output, we need to think hard and carefully about the name to be used, and the exact format and consistency of the items output. For example, serverStatus output is a bit of a mismash of lowercase and camelCase. Let's fix that over time, starting with new things.
Anything user facing must be ran by several team members first.
- Do NOT add a new $operator without signoff by the entire team.
- Do NOT add a new command without signoff by the entire team.
Use camelCase for about everything
- --commandLineOptions
- { commandNames : 1, commandOption : "abc" }
- Names of fields in objects we generate - such as command responses, profiler fields.
Include units in fields
In things like serverStatus, include the units in the stat name if there is any chance of ambiguity. For example:
We should have standards for these – i.e. megabytes should always be "MB" and not "Mb" and "Megabytes" in different places. So the standards are:
- for bytes : use "MB" and show in megabytes unless you know it will be tiny. Note you can use a float so 0.1MB is fine to show.
- for time: use millis ("Ms") for time by default. you can also use Secs and a float for times you know will be very long.
- for microseconds, use "Micros" as the suffix, e.g., timeMicros.
PLEASE POST QUESTIONS IN THE FORUMS: http://groups.google.com/group/mongodb-user. Post tips and clarifications here.
blog comments powered by Disqus