Skip to content

Conventions

Jonathan Mongeau edited this page Apr 12, 2018 · 1 revision

Code Style

JavaScript

In /static the JavaScript ReactJs frontend exists.

  • Make it a component - If something can be a component, make it one. Re-use components whenever possible.
  • Naming Convention - Functions that call the database should be called async getXXXX. Every functions should be camelCase.
  • Reuse component - If something is very similar component, use it again.
  • ESLint - == Make sure ESLint is happy when you finish your component.

Python

In /application the Python backend exists. We employ a strict code style.

  • Tabs over 4 spaces - Python gets confused when there is an inconsistent use of spaces and tabs. In this project we use tabs.
  • Return dictionaries instead of objects - We use SQL Alchemy as our database object model. In our get functions for these models we always return dictionaries instead of instances of objects. (Data speaks for itself)
  • Using functions over classes - SQL Alchemy forces us to use classes to define our models, this is the only time you will find the keyword class in our code. REST API's feel functional in nature, therefore our pattern on the backend is to use functions instead a driver class whenever possible.