Skip to content

Programming practices

KKrzelowska edited this page Jan 6, 2021 · 4 revisions

Naming Variables

We are using CamelCase.
Names should be descriptive enough so you don't have to leave comments in the code. Names should explain whats going on.

Importing modules

First external modules like react, mobx, then modules from project.
Example:
import { toJS } from "mobx";
import Chart from "./components/Chart";

SOLID

SRP -> Single Responsibility principle
Each module should have one and only one function and reason to change.
As modules depend on each other, it should be directly connected/intertwined with only one module.
DRY -> DO NOT REPEAT YOURSELF
The most important rule, that should be our guiding star.
The code should be written in a reusable components, so instead of repetition, we can just import once written module to fight redundancy of data.

Testing

For each new component we are writting tests that checks if it fulfills its specific task. Before committing changes, we are running tests by using command:
npm test

Good to know literature

Clean Code by Robert C. Martin
Clean Architecture by Robert C. Martin
Test Driven Development by Kent Beck

Clone this wiki locally