A. General Coding Notes

  1. Write a few lines as possible.
  2. Try to have small atomic functions, then avoid long functions
  3. Use appropriate naming conventions
  4. Segment blocks of code in the same section into paragraphs.
  5. Use indentation to mark the beginning and end of control structures. Clearly specify the code between them.
  6. Don’t use lengthy functions. Ideally, a single function should carry out a single task.
  7. Use the DRY (Don’t Repeat Yourself) principle. Automate repetitive tasks whenever necessary. The same piece of code should not be repeated in the script.
  8. Avoid Deep Nesting. Too many nesting levels make code harder to read and follow.
  9. Capitalize SQL special words and function names to distinguish them from table and column names.
  10. Avoid long lines. It is easier for humans to read blocks of lines that are horizontally short and vertically long.
  11. Preferences for creating functions/classes/modules in separate files (rather than one script of 1M lines).
  12. Any script/code taken from anywhere should be accompanied by a reference/link/license...
  13. Code Refactoring
  14. Use Meaningful Names for Variables and Functions
  15. Provide clear documentation
  16. Commenting when necessary, as usually, your code should be cristal clear to understand
  17. Comments explain the "why," not the "how."
  18. Avoid Obvious Comments, Commenting your code is fantastic; however, it can be overdone or just be plain redundant
  19. Keep in mind that comments are more about coding clarification, and documentation is more about explanation, role, and theory