The order of words should increase in specificity.
❌ Don't do:
let Car, // <- root class
CombustionCar,
FordCombustionCar,
ElectricCar,
TeslaElectricCar;
✅ Do this:
let Car, // <- root class
CarCombustion,
CarCombustionFord,
CarElectric,
CarElectricTesla;
Verbs are used in function names. Verbs with !
have side effects.
Intent | Verbs |
---|---|
Create | make , build! |
Read | get , read! |
Compute | is |
Update | set! , add! , write! |
Destroy | remove! |
A function that parses a string into a custom type. | |
---|---|
❌ | parseCustomType |
✅ | makeCustomTypeFromString |
NOTE: Compute functions should be pure. If there needs to be some side effect in a computation, it should happen outside of the function and passed as an argument.
A method that validates some config. | |
---|---|
❌ | validateConfig |
❌ | isValidConfig Config > Valid |
✅ | isConfigValid |
If a file exists or not. | |
---|---|
❌ | fileExists |
❌ | doesFileExist Does is not a Compute verb |
✅ | isFileExist |