When writing code, it is important to understand that someone needs to be able to review your code. For that it's important to follow a set of guidelines and principles in order to make your review process easier.
- Keep your code simple.
- Use names that are meaningful for variables, functions, and classes.
- Functions should do one task, and one task only.
- Avoid magnet classes.
- Write self documented code.
- Avoid comments that do not really add more information.
- Avoid redundant code.
- Fail fast.
- Ensure code is correct over performance
- Refactor once there is a need
- Write testable code.
- Be consistent.
- Review your code regularly.
- Write small testable unit of code.
- Outline your code similarly to how a writer would outline a book.