This repository has been archived by the owner on Sep 27, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 623
Coding Guidelines
Andy Pavlo edited this page May 31, 2018
·
5 revisions
These are general rules for development in the system. As of 2018, we do not follow all of these exactly. These are more aspirations.
-
The
TransactionContext
object should always be the first argument to any function that takes it.Good Example
ResultType CreateDatabase(concurrency::TransactionContext *txn, const std::string &database_name);
Bad Example
ResultType CreateDatabase(const std::string &database_name, concurrency::TransactionContext *txn);
-
Never use default values for function arguments. This prevents unexpected behavior and invalid invocations.
Good Example
void MyFunc(int arg1, int arg2);
Bad Example
void MyFunc(int arg1, int arg2 = 1234);
-
The order of catalog arguments to a function should go in the order of the catalog hierarchy