Skip to content

Conventions

baltasarb edited this page Apr 17, 2019 · 1 revision

Conventions

Table of Contents

Markdown

File naming

Wiki pages should be named: File-Name.md.

If a page refers a specific topic of the project's timeline then it's name should be prefixed by the corresponding timeline entry number: 1.File-Name.md

SQL

  • Discussion of the topic on StackOverflow here.

  • Keywords all in uppercase.

    • Correct: SELECT, DROP;
    • Incorrect: select, Drop;
  • Table and variable names in PascalCase, a camelCase variant, where each each word starts with an uppercase Letter:

    • Correct: UserId, UserRoutes.
    • Incorrect: userId, user-routes, Userid, user_id.
  • Each query should end with a semi-colon.

  • The primary key should refer the table it belongs to:

    • Correct:
    SELECT UserId FROM user;
    • Incorrect:
    SELECT id FROM user;
  • Foreign keys and fields should be named consistently across all tables. For instance if a field is called zip there should not be one called zipCode in another table.

  • Column and Table names should be singular, User instead of Ùsers.

  • Prefixing and Suffixing should be avoided.

Kotlin

Naming

Variables

Variable naming follows camelCase naming rules:

  • First letter is lower case.
  • Each word after the first should begin with an uppercase letter e.g: someVariable.

Classes

Classes follow PascalCase naming rules:

  • First letter is upper case.
  • Each word after the first should begin with an uppercase letter e.g: SomeClass.

Functions

Function naming follows camelCase naming rules:

  • First letter is lower case.
  • Each word after the first should begin with an uppercase letter e.g: someVariable.

Packages

Package naming follows camelCase naming rules:

  • First letter is lower case.
  • Each word after the first should begin with an uppercase letter e.g: somePariable.

Return types

Each function should explicitly declare its return type:

fun someFunction () = someService.do() //incorrect
fun someFunction () : someReturnType = someService.do() //correct