Based upon Robert C. Martin's book Clean Code.
Avoid being clever and implicit whenever possible.
Don't forget to refactor. You aren't done coding if your code isn't clean.
Naming things is cheap--have DESCRIPTIVE NAMES. It should read as close to natural language as possible, avoiding abbrev. and in-house language when possible.
GLOBAL_CONSTANT_NAME
variable_name
ClassName
functionName
Functions should have ONE(1) thing they do. Reread that.
Endeavor to have pure functions, so that they do not have side effects.
Functions should be have a maximum of three arguments. Good functions have one or two.
Like this sentence //Comment when it's not clear what you're talking about
Use your code to do most of the talking, but sometimes a concise comment can
Don't rebuild the wheel unless the wheel is a box made of rubber.
Classes can be simple. Don't build a monolith if three tiny types will do.
Git commits are like bookmarks. Great to find stuff, but too many, too often, makes them less useful.
Build first, then re-factor, but DON'T FORGET TO REFACTOR.
flags_suck = true
if(flags_suck) {
avoidWhenPossible()
}
Bracket spacing
functions, loops, and classes() {
//Stuff
}
if(no_of_lines ==1)
no_brackets == true;
Files should typically be between 100 and 500 lines of code. Concepts that are related should be kept vertically close to each other.