Coding Tips

Coding first, then read a good book about it.

一、写出优雅代码的三大法则

  1. 别嵌入太深
  2. 良好的变量命名
  3. 少写重复代码

编程Principals

  1. 童子军Rule:cleaner than you found it.
  2. 不提前优化.
  3. Code for Maintainer.
  4. YAGNI - You Aren't Gonna Need It. 不要写未来可能需要的功能。
  5. Doing the Simplest Thing. 不要 Over-engineering.

二、Naming Things

Don't abbreviate names Don't put types in variable names Add units to variables unless the type tells you Don't put types in your types (eg. Abstract, BaseX) Refactor if you find yourself naming code "Utils"

三、避免陷入 tutorial & vibe coding hell

Vibe coding 与观看 tutorial 学习 Coding 一样,会产生眼睛会了脑子却不会的错觉,没有深入思考!所以,learn coding:
  1. 关闭 tutorial 学习视频
  2. 关闭 vibe-coding
一旦完成了 tutorial,则可以观看 tutorial、开启 vibe-coding查漏补缺!

四、SOLID principles

see [React] Tips

五、Curl Cheatsheet


Date:
Words:
121
Time to read:
1 min