Skip to content

Instantly share code, notes, and snippets.

@lancepioch
Last active January 8, 2022 05:42
Show Gist options
  • Save lancepioch/636b698aa607bff2caa5f7abcdc5e874 to your computer and use it in GitHub Desktop.
Save lancepioch/636b698aa607bff2caa5f7abcdc5e874 to your computer and use it in GitHub Desktop.
Best Programming Practices and Rules
  1. Never use snake_case for naming anything (ref: see PSR-2)
  2. Don't use else except in rare appropriate circumstances (ref)
  3. Never use elseif, probably want switch (ref)
  4. Always PSR-2 format the PHP code (ref), see Styleci for automatic help
  5. Don't use "company name" anywhere, it's implied already, like saying "ATM Machine", it's redundant
  6. No unused variables (ref)
  7. Don't commit commented out code, just remove it (ref) (regular comments are fine)
  8. Never use backticks, they can be executed (ref)
  9. Don't commit dev tool usage such as console.log (ref)
  10. Never pass in ids to controllers for models, only use model binding (ref)
  11. Never use jQuery in customer facing side (ref)
  12. When reusing CSS, you must use classes (ref)
  13. Never write CSS selectors for ids (ref)
  14. Proper English for any comments or text (no reference needed)
  15. LINT all JS code, use PHPStorm or Webstorm for example (ref)
  16. Keep commits smaller (ref)
  17. Commit often (ref)
  18. Refactor to reduce conditional block levels (ref + ref)
  19. Use snake_case for mysql or postgresql tables and columns (ref)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment