363 followers
Oct 21, 2024
Do you follow these 0:00 clean coding principles?
- 0:03 Eliminate if/else branching, use early termination
- 2:18 Ambiguous definitions: “is” function prefix clearly returns booleans
- 4:06 Self-documenting code, avoid belaboured comments
- 5:39 Consistent formatting, use Eslint + Prettier to automate code style
- 7:16 DRY (don’t repeat yourself), look for opportunities to refactor, make sure to test
- 8:40 Fail or exit functions fast, related to 1 above
- 9:31 Avoid magic values, declare and use constants instead
- 10:43 Avoid violating single responsibility, use pure functions with no side effects
- 11:57 Overly clever code (code golf) leads to impenetrable single liners, need to rewrite to debug
- 14:04 Premature optimisation

George Vanous 🌱