Coding Tips 1673023474
Coding Tips 1673023474
01
Keep functions and
classes small
Smaller units are easier to comprehend
mentally. I personally breakdown a
function into multiple if it grows beyond
10 lines.
02
No Ninja Code
03
Avoid boolean traps
Take a look at the following function and try
to guess what true it does
04
Avoid magic numbers
Numerical value that are hard coded are
called magic numbers - they don't clearly
convey a meaning.
05
Avoid deeply nested code
06
Proper variable naming
Variables and functions should be
named sufficiently clear to convey what
they represent and do - but do not use
unnecessarily long names.
Avoid abbreviations
07
Sufficient documentation
& commensts