目录
Chapter 1: Clean Code / 整洁的代码 1
1.1 There Will Be Code / 要有代码 2
1.2 Bad Code / 烂代码 3
1.2.1 Attitude / 态度 4
1.2.2 The Primal Conundrum / 难题 5
1.3 The Art of Clean Code / 整洁代码的艺术 5
What Is Clean Code / 什么是整洁的代码 6
1.4 Putting All This Together / 综述 9
1.4.1 Why Should We Be Clean / 代码为什么要整洁 9
1.4.2 Productivity / 生产力 10
1.4.3 Livability / 宜居性 13
1.5 We Read More Than We Write / 读比写多 13
1.6 The Boy Scout Rule / 童子军军规 14
PART I Code / 第 一部分 代码
Chapter 2: Clean That Code! / 清理那些代码! 19
2.1 The Cleaning Process / 清理过程 30
2.2 Conclusion / 小结 37
2.3 Postscript: Future Bob Playing with Grok3 /
附记:未来的鲍勃体验Grok3 37
2.4 Postscript Conclusion / 附记小结 40
Chapter 3: First Principles / 首要原则 41
3.1 Everything Small, Well Named, Organized, and Ordered / 一切都要小巧、命名得当、组织有序且排序合理 42
Functions / 函数 42
3.2 A More Significant Example / 更明显的例子 44
Independent Deployability / 独立部署 68
3.3 A Final Thought / 最后的思考 68
Chapter 4: Meaningful Names / 有意义的名称 71
4.1 Use Intention-Revealing Names / 使用表意明确的名称 72
4.1.1 Build a System of Names / 构建命名体系 73
4.1.2 Avoid Disinformation / 避免误导 74
4.1.3 Make Meaningful Distinctions / 做有意义的区分 75
4.1.4 Use Pronounceable Names / 使用读得出来的名称 76
4.1.5 Use Searchable Names / 使用可搜索的名称 77
4.1.6 Use Names of Appropriate Length / 使用长度适宜的名称 78
4.1.7 Avoid Encodings / 避免使用编码 80
4.1.8 Use Appropriate Parts of Speech / 使用恰当的词性 81
4.1.9 Consider Keyword Parameters / 考虑关键词参数 82
4.1.10 Don’t Be Cute / 别玩儿梗 83
4.1.11 Pick One Word per Concept / 每个概念对应一个词 83
4.1.12 Use Solution Domain Names / 使用源自解决方案领域的名称 83
4.1.13 Use Problem Domain Names / 使用源自所涉问题领域的名称 84
4.1.14 Add Meaningful Context / 添加有意义的上下文 84
4.1.15 Don’t Add Gratuitous Context / 不要添加没用的上下文 86
4.2 Final Words / 小结 87
Chapter 5: Comments / 注释 89
5.1 Compensating for Failure / 弥补失败 90
5.1.1 Hidden or Obscured Comments / 隐藏或被遮掩的注释 90
5.1.2 Lying Comments / 撒谎的注释 91
5.1.3 Comments That Are Too Intimate / 过于细节化的注释 92
5.1.4 Comments Do Not Make Up for Bad Code /
注释不能美化烂代码 92
5.1.5 Explain Your Intent in Code / 用代码阐释意图 92
5.2 Good Comments / 好注释 92
5.2.1 Legal Comments / 法律信息 93
5.2.2 Informative Comments / 信息量充足的注释 93
5.2.3 Explanation of Intent / 解释意图 94
5.2.4 Clarification / 阐释 95
5.2.5 Warning of Consequences / 警示后果 96
5.2.6 Amplification / 强调 96
5.2.7 Javadocs (and Their Ilk) in Public APIs /
公共API中的Javadoc及同类文档 97
5.3 Bad Comments / 烂注释 97
5.3.1 Mumbling / 喃喃自语 97
5.3.2 Redundant Comments / 多余的注释 98
5.3.3 Misleading Comments / 误导性注释 99
5.3.4 Redundancy and Imprecision / 冗余和不精确 99
5.3.5 Mandated Comments / 循规式注释 102
5.3.6 Journal Comments / 日志式注释 102
5.3.7 Noise Comments / 噪声注释 103
5.3.8 Scary Noise / 可怕的噪声 105
5.3.9 TODO Comments / TODO注释 106
5.3.10 Use a Function or a Variable Instead of a Comment / 能用函数或变量就不用注释 106
5.3.11 Position Markers / 位置标记 107
5.3.12 Attributions and Bylines / 归属与署名 107
5.3.13 Commented-Out Code / 被注释掉的代码 107
5.3.14 HTML Comments / HTML注释 108
5.3.15 Nonlocal Information / 非本地信息 109
5.3.16 Too Much Information / 信息过多 109
5.3.17 Unobvious Connection / 不明显的关联 110
5.3.18 Function Headers / 函数头部注释 110
5.3.19 Javadocs in Nonpublic Code / 非公共代码中的Javadoc 111
5.3.20 Example / 示例 111
5.4 Conclusion / 小结 115
Chapter 6: Formatting / 规范代码格式 117
6.1 The Purpose of Formatting / 规范代码格式的目的 118
6.2 Vertical Formatting / 纵向格式 118
6.2.1 Vertical Openness between Concepts / 概念间的纵向留白 120
6.2.2 Vertical Density / 纵向紧密度 121
6.2.3 Vertical Distance / 纵向距离 122
6.2.4 Variable Declarations / 变量声明 122
6.2.5 Dependent Functions / 相关函数 125
6.2.6 Conceptual Affinity / 概念关联性 126
6.3 Horizontal Formatting / 横向格式 127
6.3.1 Horizontal Openness and Density / 横向留白与紧密度 128
6.3.2 Horizontal Alignment / 横向对齐 129
6.3.3 Indentation / 缩进 130
6.3.4 Breaking Indentation / 违反缩进规则 132
6.4 Team Rules / 团队规则 132
6.5 Uncle Bob’s Formatting Rules / 鲍勃大叔的代码格式规则 133
Chapter 7: Clean Functions / 整洁的函数 137
7.1 Small! / 短小 138
7.1.1 Well-Written Prose / 好散文 139
7.1.2 One Level of Abstraction per Function / 每个函数一个抽象层级 139
7.2 Reading Code from Top to Bottom: The Stepdown Rule / 自顶向下读代码:下梯规则 140
Entanglement / 纠缠 142
7.3 switch Statements / switch语句 142
7.4 Clean Functions: A Deeper Look / 深入探讨整洁的函数 144
7.4.1 Contextual / 上下文相关 144
7.4.2 Nameable / 可命名 145
7.4.3 Insulated / 被隔离 148
7.4.4 Homogenous / 同质 151
7.4.5 Pure / 纯一 153
7.4.6 Partial Purity / 部分纯一性 155
7.5 Conclusion / 小结 157
Chapter 8: Function Heuristics / 关于函数的经验之谈 159
8.1 Function Arguments / 函数参数 159
8.1.1 Variadic Arguments / 可变参数 161
8.1.2 More Than Three / 参数多于3个? 161
8.1.3 Keyword Arguments / 关键字参数 161
8.1.4 Flag Arguments / 标识参数 161
8.1.5 Output Arguments / 输出参数 162
8.1.6 Error Codes / 错误码 163
8.2 Command Query Separation / 命令-查询分离 164
8.3 Prefer Exceptions to Returning Error Codes / 使用异常替代返回错误码 165
8.3.1 Caveat Emptor / 责任自负 165
8.3.2 Extract try/catch Blocks / 抽离try/cache代码块 167
8.3.3 Error Handling Is One Thing / 错误处理就是一件事 168
8.3.4 The Dependency Magnet of Error Codes / 错误码的依赖磁铁 168
8.4 DRY: Don’t Repeat Yourself / DRY:别重复自己 169
8.4.1 Simple Repeated Code / 简单重复的代码 169
8.4.2 Similar Code / 相似代码块 170
8.4.3 Loop Duplication / 循环重复 174
8.4.4 Accidental versus Essential Duplication / 偶合重复与本质重复 177
8.5 Side Effects / DRY:副作用 177
8.5.1 We Are Bad at This / 力有未逮 178
8.5.2 Functional Languages / 函数式编程语言 178
8.5.3 Object-Oriented Languages / 面向对象编程语言 180
8.6 Structured Programming / 结构化编程 181
8.6.1 Sequence / 顺序结构 182
8.6.2 Selection / 选择结构 182
8.6.3 Iteration / 循环结构 182
8.7 This Is Too Much to Constantly Keep in Mind / 太多应牢记的事 183
8.8 Conclusion / 小结 184
Chapter 9: The Clean Method / 整洁的方法 185
9.1 Make It Right / 把它改好 186
9.2 Example / 示例 188
Considering the Design and Architecture / 考虑设计与架构 204
9.3 Conclusion / 小结 210
Chapter 10: One Thing / 只做一件事 211
10.1 Extract Method Refactoring / 提取方法重构 212
This Shouldn’t Be Controversial / 不应置疑 214
10.2 What Are Large Functions Anyway / 到底什么是巨大函数 217
Extraction and Classes / 提取与类 235
10.3 Conclusion / 小结 239
Chapter 11: Be Polite / 保持得体 241
11.1 The Newspaper Metaphor / 报纸隐喻 243
Be Polite / 保持得体 244
11.2 The Stepdown Rule: Once Again / 再谈下梯规则 245
11.3 The Abstraction Roller Coaster / 抽象过山车 246
11.4 This Is How We Write, but Not How We Want to Read / 这么写,但不想这么读 246
Chapter 12: Objects and Data Structures / 对象与数据结构 249
12.1 What Is an Object / 何为对象 250
12.2 Data Abstraction / 数据抽象 251
12.3 Data/Object Antisymmetry / 数据/对象的反对称性 252
12.4 The Law of Demeter / 得墨忒耳律 255
12.4.1 Trainwrecks / 火车失事 256
12.4.2 Hybrids / 混合结构 256
12.4.3 Hiding Structure / 隐藏结构 257
12.5 Data Transfer Objects / 数据传输对象 258
12.5.1 The Object/Relational “Impedance Mismatch” / 对象/关系“阻抗不匹配” 259
12.5.2 Using Objects and Data Structures / 使用对象和数据结构 259
12.6 switch Statements / switch语句 260
12.6.1 The OO Solution / 面向对象解决方案 263
12.6.2 Not So Fast, Johnson / 别高兴得太早 264
12.7 The OO/Procedural Trade-off / 选择面向对象还是选择过程式 264
12.8 But What About Performance / 性能怎么办 265
12.9 Conclusion / 小结 265
Chapter 13: Clean Classes / 整洁的类 267
13.1 Classes and Modules versus Files / 类和模块与文件对比 267
13.2 What Should a Class Contain / 类应该包含什么 268
13.2.1 Characterizing Class Design / 类设计的特征 269
13.2.2 Heuristics and Characteristics / 经验与特征 270
13.2.3 When Is a Class Too Large / 类什么时候算过大 271
13.2.4 Policies in Code / 代码中的策略 273
13.2.5 Where Reasons to Change Hide / 变更理由隐藏之处 274
13.2.6 Fixing the Problem / 修正问题 275
13.2.7 An Overly Open Implementation / 一种过度开放的实现 277
13.2.8 Should We Do Anything Now / 该做点什么吗 278
13.2.9 What About Now / 现在怎么办 278
13.2.10 Closed, Cohesive, Single-Responsibility Classes / 闭合、高内聚、单一职责的类 282
13.2.11 When Policies Change / 策略改变时 284
13.2.12 Is This Overengineering / 这算过度工程化吗 284
13.2.13 Simpler Testing / 更简单的测试 285
13.2.14 Enter AI / 接入AI 286
13.2.15 It Will Be Wrong / 它会犯错 287
Chapter 14: Testing Disciplines / 测试准则 289
14.1 Discipline 1: Test-Driven Development (TDD) / 准则1:测试驱动的开发(TDD) 291
The Three Laws of TDD / TDD三法则 291
14.2 Discipline 2: Test && Commit || Revert (TCR) / 准则2:测试 && 提交 || 回退(TCR) 292
14.3 Discipline 3: Small Bundles / 准则3:小规模增量开发 293
14.4 Design / 设计 293
14.5 Discipline / 准则 294
14.5.1 Tedious, Boring, and Slow / 枯燥、烦琐且低效 294
14.5.2 Debugging / 调试 294
14.5.3 Documentation / 文档 295
14.5.4 Reliability / 可靠性 295
14.5.5 Design / 设计 296
14.5.6 Reprise / 总结回顾 296
14.5.7 The Angel and the Devil / 天使与恶魔 297
14.5.8 Muzzling the Devil / 驯服心魔 297
14.5.9 Complications and Loopholes / 复杂情况与漏洞 298
14.5.10 Costs and Repercussions / 代价与影响 299
14.6 Keeping Tests Clean / 保持测试整洁 299
14.7 Tests Enable the -ilities / 测试赋能 300
Chapter 15: Clean Tests / 整洁的测试 303
15.1 Domain-Specific Testing Language / 用于测试的领域特定语言 307
15.1.1 Composed Assertions / 组合断言 307
15.1.2 Composed Test Results / 组合测试结果 307
15.1.3 Dual Standard / 双重标准 309
15.1.4 The Single Assert Rule / 单一断言规则 309
15.1.5 The Single Act Rule / 单一执行规则 310
15.2 F.I.R.S.T. / F.I.R.S.T 310
15.2.1 Fast / 快速 310
15.2.2 Isolated / 独立 310
15.2.3 Repeatable / 可重复 310
15.2.4 Self-Validating / 自验证 311
15.2.5 Timely / 及时 311
15.3 Test Design / 测试设计 311
15.4 Conclusion / 小结 311
Chapter 16: Acceptance Testing / 验收测试 313
16.1 The Acceptance Testing Discipline / 验收测试准则 314
16.1.1 The Discipline / 准则 315
16.1.2 The Continuous Build / 持续构建 316
16.2 Conclusion / 小结 316
Chapter 17: AIs, LLMs, and God Knows What / AI、LLM和天知道还有啥东西 317
17.1 Programming by Prompt / 用提示词编程 319
17.1.1 Infancy / 起步阶段 324
17.1.2 A SWAG / 斗胆盲猜 324
17.2 Conclusion / 小结 328
PART II Design / 第二部分 设计
Chapter 18: Simple Design / 简单设计 331
18.1 YAGNI / YAGNI 333
18.2 Covered by Tests / 测试覆盖 333
18.2.1 An Asymptotic Goal / 渐进目标 333
18.2.2 Design / 设计? 334
18.3 Maximize Expression / 揭示意图 334
18.3.1 The Underlying Abstraction / 底层抽象 336
18.3.2 Tests: The Other Half of the Problem / 测试:问题的后半部分 337
18.4 Minimize Duplication / 最小化重复 337
Accidental Duplication / 偶合重复 338
18.5 Minimize Size / 最小化规模 339
Simple Design / 简单设计 339
Chapter 19: The SOLID Principles/ SOLID原则 341
19.1 SRP: The Single Responsibility Principle / SRP:单一职责原则 343
19.1.1 Accidental Duplication / 偶合重复 344
19.1.2 Solutions / 解决方案 345
19.1.3 Higher Levels / 更高层级 346
19.2 OCP: The Open-Closed Principle / OCP:开放-闭合原则 347
19.2.1 A Thought Experiment / 思想实验 347
19.2.2 Directional Control / 方向控制 350
19.2.3 Information Hiding / 信息隐藏 350
19.2.4 Conclusion / 小结 351
19.3 LSP: The Liskov Substitution Principle / LSP:里氏替换原则 351
19.3.1 LSP and Design / LSP与设计 352
19.3.2 Taxi Aggregator / 出租车调度聚合平台 353
19.4 ISP: The Interface Segregation Principle / ISP:接口分离原则 354
19.4.1 ISP and Language / ISP与编程语言 355
19.4.2 ISP and Design / ISP与设计 355
19.5 DIP: The Dependency Inversion Principle / DIP:依赖倒置原则 356
19.5.1 Stable Abstractions / 稳定抽象 358
19.5.2 Factories / 工厂模式 359
19.5.3 Concrete Components / 具体组件 360
Chapter 20: Component Principles / 组件原则 363
20.1 Components / 组件 364
20.2 A Brief History of Components / 组件简史 364
20.2.1 Relocatability / 可重定位 367
20.2.2 Linkers / 连接器 367
20.3 Component Cohesion / 组件内聚性 368
20.3.1 The Reuse/Release Equivalence Principle (REP) / REP:复用/发布等价原则 369
20.3.2 The Common Closure Principle (CCP) / CCP:共同封闭原则 370
20.3.3 The Common Reuse Principle (CRP) / CRP:共同复用原则 371
20.3.4 The Tension Diagram for Component Cohesion / 组件内聚性张力图 372
20.3.5 In Summary… / 小结 373
20.4 Component Coupling / 组件耦合 373
20.4.1 The Acyclic Dependencies Principle (ADP) / ADP:无循环依赖原则 374
20.4.2 The Stable Dependencies Principle (SDP) / SDP:稳定依赖原则 379
20.4.3 The Stable Abstractions Principle (SAP) / SAP:稳定抽象原则 383
20.5 Conclusion / 小结 387
Chapter 21: Continuous Design / 持续设计 389
21.1 Continuous Change / 持续变更 390
21.2 Continuous Design / 持续设计 391
21.3 Sailing on the Four Cs of Continuous Design / 航行于持续设计的4C考量之上 392
21.3.1 Clarity / 清晰性 393
21.3.2 Conciseness / 简洁性 398
21.3.3 Confirmability / 可验证性 406
21.3.4 Cohesion / 内聚性 416
21.4 When Else Do We Design / 还需要在何时进行设计 420
21.4.1 Up-front Design / 设计前置 420
21.4.2 Readying for Work / 为工作做准备 421
21.4.3 Starting Work / 开始工作 421
21.4.4 Doing Work / 做工作 422
Chapter 22: Concurrency / 并发编程 423
22.1 Why Concurrency / 为什么要并发 424
22.1.1 Myths and Misconceptions / 传言与误解 425
22.1.2 Challenges / 挑战 426
22.2 Concurrency Defense Principles / 并发防御原则 427
22.2.1 Single Responsibility Principle / 单一职责原则 427
22.2.2 Corollary: Limit the Scope of Data / 推论:限制数据的作用域 427
22.2.3 Corollary: Use Copies of Data / 推论:使用数据副本 428
22.2.4 Corollary: Threads Should Be as Independent as Possible / 推论:线程应尽可能独立 428
22.3 Know Your Language and Library / 了解你使用的语言和库 428
Thread-Safe Collections / 线程安全工具集 429
22.4 Know Your Execution Models / 了解执行模型 429
22.4.1 Producer-Consumer / 生产者-消费者模型 430
22.4.2 Readers-Writers / 读者-写者模型 430
22.4.3 Dining Philosophers / 哲学家进餐问题 431
22.5 Beware Dependencies between Synchronized Methods / 警惕同步方法之间的依赖 431
22.6 Keep Synchronized Sections Small / 保持同步区短小 431
22.7 Writing Correct Startup and Shutdown Code Is Hard / 正确的启动代码和关闭代码难以编写 432
22.8 Testing Threaded Code / 测试线程代码 432
22.8.1 Treat Spurious Failures as Candidate Threading Issues / 将偶发失败看作潜在的线程问题 433
22.8.2 Get Your Nonthreaded Code Working First / 先让非线程代码工作 433
22.8.3 Make Your Threaded Code Pluggable / 编写可插拔的线程代码 434
22.8.4 Make Your Threaded Code Tunable / 编写可调优的线程代码 434
22.8.5 Run with More Threads Than Processors / 运行比处理器数量多的线程 434
22.8.6 Run on Different Platforms / 在不同平台上运行 434
22.8.7 Instrument Your Code to Try and Force Failures / 安插试错代码,尝试并强制代码失败 435
22.9 2025 Update and Report from the Field / 2025年实战更新及报告 437
Data Integrity / 数据完整性 437
22.10 Conclusion / 小结 442
PART III Architecture / 第三部分 架构
Chapter 23: The Two Values of Software / 软件的两大价值 445
Keeping Options Open / 保留可能性 446
Chapter 24: Independence / 独立性 449
24.1 Use Cases / 用例 450
24.2 Operation / 运行 450
24.3 Development / 开发 451
24.4 Deployment / 部署 451
24.5 Leaving Options Open / 保留可能性 451
Chapter 25: Architectural Boundaries / 架构的边界 453
25.1 What Lines Do You Draw, and When / 何时划定边界,划定怎样的边界 454
25.2 Plug-in Architecture / 插件架构 456
25.3 Case Study: FitNesse / 案例研究:FitNesse 457
25.4 Conclusion / 小结 459
Chapter 26: Clean Boundaries / 整洁的边界 461
26.1 Third-Party IoT Framework: Lots o’ Boundaries / 第三方物联网框架:诸多边界 462
26.2 UI/Application Boundary / 用户界面/应用边界 466
26.2.1 SOLID and Hexagonal Architecture / SOLID原则与六边形架构 469
26.2.2 Exploring and Learning Boundaries / 探索和学习边界 470
26.2.3 Using Code That Does Not Yet Exist / 使用尚不存在的代码 473
26.3 Clean Boundaries / 整洁的边界 474
Chapter 27: The Clean Architecture / 整洁的架构 475
27.1 The Dependency Rule / 依赖规则 476
27.1.1 Entities / 实体层 477
27.1.2 Use Cases / 用例层 477
27.1.3 Interface Adapters / 接口适配层 478
27.1.4 Frameworks and Drivers / 框架与驱动层 478
27.1.5 Only Four Circles / 只有4个圈层吗 478
27.1.6 Crossing Boundaries / 跨越边界 479
27.1.7 What Data Crosses the Boundaries / 什么数据会跨越边界 479
27.1.8 A Typical Scenario / 典型场景 479
27.2 Conclusion / 小结 481
PART IV Craftmanship / 第四部分 匠艺
“A Great Number” / “大量” 484
Eight Decades / 80多年 484
Nerds and Saviors / 书呆子与救世主 487
Notoriety / 名声 488
Role Models and Villains / 榜样与恶棍 489
We Rule the World / 我们“主宰”世界 490
Catastrophes / 灾难 491
The Oath / 程序员誓言 492
Chapter 28: Harm / 有害 495
28.1 No Harm to Society / 对社会无害 496
28.2 No Harm to Function / 对功能无害 497
28.3 No Harm to Structure / 对结构无害 499
28.4 Soft / 柔性 500
28.5 Tests / 测试 501
Chapter 29: No Defect in Behavior or Structure / 不损害软件行为或结构 503
29.1 Making It Right / 把它改好 504
29.1.1 What Is Good Structure / 什么是好结构 504
29.1.2 Eisenhower’s Matrix / 艾森豪威尔决策矩阵 506
29.2 Programmers Are Stakeholders / 程序员是利益相关者 507
29.3 Do Your Best / 尽己所能 508
Chapter 30: Repeatable Proof / 可重复证据 511
30.1 Dijkstra / 迪杰斯特拉 511
Proving Correctness / 证明正确性 512
30.2 Structured Programming / 结构化编程 514
30.3 Functional Decomposition / 功能分解 516
30.4 Test-Driven Development et al. / TDD及同类准则 517
Chapter 31: Small Cycles / 小周期 519
31.1 The History of Source Code Control / 源码控制史 519
31.1.1 Punch Cards / 打孔卡 519
31.1.2 Continuous Integration / 持续集成 523
31.1.3 Short Cycles / 短周期 524
31.2 Continuous Integration / 持续集成 524
31.3 Branches versus Toggles / 分支与功能开关 525
31.4 Continuous Deployment / 持续部署 527
31.5 Continuous Build / 持续构建 528
Chapter 32: Relentless Improvement / 持续打磨 529
32.1 Test Coverage / 测试覆盖率 529
32.2 Mutation Testing / 变异测试 530
32.3 Semantic Stability / 语义稳定性 530
32.4 Cleaning / 清洁 531
32.5 Creations / 创作成果 531
Chapter 33: Maintain High Productivity / 保持高生产力水平 533
33.1 Viscosity / 黏性 533
33.1.1 Building / 构建 534
33.1.2 Testing / 测试 534
33.1.3 Debugging / 调试 535
33.1.4 Deploying / 部署 535
33.2 Managing Distractions / 干扰管理 535
33.2.1 Meetings / 会议 536
33.2.2 Music / 音乐 536
33.2.3 Mood / 心情 537
33.2.4 The Flow / 心流 537
33.3 Time Management / 时间管理 538
Chapter 34: Work as a Team / 团队协作 539
34.1 Collaborative Programming / 协同编程 539
34.2 Open/Virtual Office / 开放式办公室/虚拟办公室 540
Chapter 35: Estimate Honestly and Fairly / 靠谱和合理地估算 543
35.1 Lies / 谎言 544
35.2 Honesty, Accuracy, Precision / 靠谱、准确、精确 544
35.3 Lessons from Me / 我的教训 545
35.3.1 Story #1: Vectors / 故事1:向量 545
35.3.2 Story #2: pCCU / 故事2:pCCU 546
35.3.3 The Lesson / 教训 547
35.4 Accuracy and Precision / 准确性与精确性 547
35.5 Aggregation / 汇总 548
35.6 Honesty / 靠谱 549
35.7 Pressure / 压力 550
Chapter 36: Respect for Fellow Programmers / 尊重程序员同行 553
Chapter 37: Never Stop Learning / 永不停止学习 555
Afterword / 后记 557
Appendix: The Clean Code Debate / 附录A 激辩《代码整洁之道》 561
A.1 Introductions / 开篇 562
A.2 Method Length / 方法长度 563
A.3 Method Length Summary / 关于方法长度讨论的总结 575
A.4 Comments / 注释 576
A.5 Comments Summary / 关于注释讨论的总结 590
A.6 John’s Rewrite of PrimeGenerator / 约翰对PrimeGenerator类的改写 591
A.7 A Tale of Two Programmers / 双“程”记 596
A.8 Bob’s Rewrite of PrimeGenerator2 / 鲍勃对PrimeGenerator2类的改写 599
A.9 Test-Driven Development / TDD 603
A.10 TDD Summary / 关于TDD讨论的总结 612
A.11 Closing Remarks / 结束语 613
Bibliography / 参考文献 615