Skip to content
This repository has been archived by the owner on Sep 27, 2019. It is now read-only.

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.

  1. 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);
  2. 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);
  3. The order of catalog arguments to a function should go in the order of the catalog hierarchy

Clone this wiki locally