Skip to content

Code Conventions

Arathi Biju edited this page Mar 20, 2022 · 8 revisions

Front End Code Conventions

Formatting and Linting Conventions

ESlint, along with prettier is installed in this project to enforce the formatting conventions. Installing the prettier and ESLint extensions in your IDE is highly recommended

Naming Conventions

  • We use PascalCase in naming components and other files eg. MyComponent
  • We use camelCase in naming instances eg. const myComponent
  • Use descriptive names to ensure easily readable and understandable code without comments as much as possible.

Styling Conventions

  • We primarily use module.scss files for styling.

Commenting

  • Use single line comments for inline commenting or for explaining a single line of code (leave a space after the //)
  • Use multi line comments for comments above function declarations and above components, at the top of the file or for having explanations longer than one line. Components must be commented above to describe how it can be used.

Back End Code Conventions

The Project follows the Default IDE code styling scheme of IntelliJ IDEA. More information on this can be found here. The project follows the Java code conventions created by Oracle; more detailed information is found here. Below is information pertaining to the most common conventions and choices made regarding code styling.

Naming Conventions

The naming conventions were the same as the Front End naming conventions described above.

Indentation and Spacing

Indentation and spacing are as per the default IDE settings.

Braces and Semicolons

  • Braces:

    • Opening braces placed on the same line as the function and loop declaration.
  • Semicolons:

    • Semicolon should be placed at the end of a line of code.

File Constraints

The width constraints are system dependent and there should be a hardwrap at 120 characters. This is per the default IDE settings.

Comments

Comments were only used when it was important for the code so that obvious comments were avoided.

  • If a comment required more then one line then multiline comment syntax should be followed e.g.
    /* Comment for code here */

Package Management

There was no limit on Packages that can be imported contributers' judgement was advised.

Package Names
Package names should be in lowercase

File Hierarchy
Files were ordered in alphabetical order as per the default IDE setting.