The Rules of Programming HOW TO WRITE BETTER CODE
by Chris Zimmerman
Released December 2022
Publisher(s): O'Reilly Media, Inc.
ISBN: 9781098133115
Rule 1 | As Simple as Possible, but No Simpler
Rule 2 | Bugs Are Contagious
Rule 3 | A Good Name Is the Best Documentation
Rule 4 | Generalization Takes Three Examples
Rule 5 | The First Lesson of Optimization Is Don’t Optimize
| Interlude: In Which the Previous Chapter Is Criticized
Rule 6 | Code Reviews Are Good for Three Reasons
Rule 7 | Eliminate Failure Cases
Rule 8 | Code That Isn’t Running Doesn’t Work
Rule 9 | Write Collapsible Code
Rule 10 | Localize Complexity
Rule 11 | Is It Twice as Good?
Rule 12 | Big Teams Need Strong Conventions
Rule 13 | Find the Pebble That Started the Avalanche
Rule 14 | Code Comes in Four Flavors
Rule 15 | Pull the Weeds
Rule 16 | Work Backward from Your Result, Not Forward from Your Code
Rule 17 | Sometimes the Bigger Problem Is Easier to Solve
Rule 18 | Let Your Code Tell Its Own Story
Rule 19 | Rework in Parallel
Rule 20 | Do the Math
Rule 21 | Sometimes You Just Need to Hammer the Nails
| Conclusion: Making the Rules Your Own
A | Reading C++ for Python Programmers
B | Reading C++ for JavaScript Programmers
【Bing Microsoft Translator - 从英语翻译】
编程规则 如何编写更好的代码
规则 1 |尽可能简单,但不简单
规则 2 |虫子具有传染性
规则 3 |一个好的名字是最好的文档
规则 4 |泛化有三个例子
规则 5 |优化的第一课是不要优化
|插曲:其中批评了前一章
规则 6 |代码审查有好处,原因有三
规则 7 |消除故障案例
规则 8 |未运行的代码不起作用
规则 9 |编写可折叠代码
规则 10 |本地化复杂性
规则 11 |是两倍好吗?
规则 12 |大团队需要强大的惯例
规则 13 |找到引发雪崩的鹅卵石
规则 14 |代码有四种风格
规则 15 |拔除杂草
规则 16 |从结果向后工作,而不是从代码向前工作
规则 17 |有时更大的问题更容易解决
规则 18 |让您的代码讲述自己的故事
规则 19 |并行返工
规则 20 |算一算
规则 21 |有时你只需要敲钉子
|结论:制定自己的规则
A |Python 程序员阅读C++
B |面向 JavaScript 程序员的阅读C++
参考资料
1. The Rules of Programming. https://www.oreilly.com/library/view/the-rules-of/9781098133108/