| 作 者: | 马丁 |
| 出版社: | 人民邮电出版社 |
| 丛编项: | 典藏原版书苑 |
| 版权说明: | 本书为出版图书,暂不支持在线阅读,请支持正版图书 |
| 标 签: | 软件工程/开发项目管理 |
| ISBN | 出版时间 | 包装 | 开本 | 页数 | 字数 |
|---|---|---|---|---|---|
| 未知 | 暂无 | 暂无 | 未知 | 0 | 暂无 |
Chapter 1: Clean Code 1
There Will Be Code 2
Bad Code 3
The Total Cost of Owning a Mess 4
The Grand Redesign in the Sky 5
Attitude 5
The Primal Conundrum 6
The Art of Clean Code? 6
What Is Clean Code? 7
Schools of Thought 12
We Are Authors 13
The Boy Scout Rule 14
Prequel and Principles 15
Conclusion 15
Bibliography 15
Chapter 2: Meaningful Names 17
Introduction 17
Use Intention-Revealing Names 18
Avoid Disinformation 19
Make Meaningful Distinctions 20
Use Pronounceable Names 21
Use Searchable Names 22
Avoid Encodings 23
Hungarian Notation 23
Member Prexes 24
Interfaces and Implementations 24
Avoid Mental Mapping 25
Class Names 25
Method Names 25
Dont Be Cute 26
Pick One Word per Concept 26
Dont Pun 26
Use Solution Domain Names 27
Use Problem Domain Names 27
Add Meaningful Context 27
Dont Add Gratuitous Context 29
Final Words 30
Chapter 3: Functions 31
Small! 34
Blocks and Indenting 35
Do One Thing 35
Sections within Functions 36
One Level of Abstraction per Function 36
Reading Code from Top to Bottom: The Stepdown Rule 37
Switch Statements 37
Use Descriptive Names 39
Function Arguments 40
Common Monadic Forms 41
Flag Arguments 41
Dyadic Functions 42
Triads 42
Argument Objects 43
Argument Lists 43
Verbs and Keywords 43
Have No Side Effects 44
Output Arguments 45
Command Query Separation 45
Prefer Exceptions to Returning Error Codes 46
Extract Try/Catch Blocks 46
Error Handling Is One Thing 47
The Errorjava Dependency Magnet 47
Dont Repeat Yourself 48
Structured Programming 48
How Do You Write Functions Like This? 49
Conclusion 49
SetupTeardownIncluder 50
Bibliography 52
Chapter 4: Comments 53
Comments Do Not Make Up for Bad Code 55
Explain Yourself in Code 55
Good Comments 55
Legal Comments 55
Informative Comments 56
Explanation of Intent 56
Clarication 57
Warning of Consequences 58
TODO Comments 58
Amplication 59
Javadocs in Public APIs 59
Bad Comments 59
Mumbling 59
Redundant Comments 60
Misleading Comments 63
Mandated Comments 63
Journal Comments 63
Noise Comments 64
Scary Noise 66
Dont Use a Comment When You Can Use a Function or a Variable 67
Position Markers 67
Closing Brace Comments 67
Attributions and Bylines 68
Commented-Out Code 68
HTML Comments 69
Nonlocal Information 69
Too Much Information 70
Inobvious Connection 70
Function Headers 70
Javadocs in Nonpublic Code 71
Example 71
Bibliography 74
Chapter 5: Formatting 75
Chapter 6: Objects and Data Structures 93
Chapter 7: Error Handling 103
Chapter 8: Boundaries 113
Chapter 9: Unit Tests 121
Chapter 10: Classes 135
Chapter 11: Systems 153
Chapter 12: Emergence 171
Chapter 13: Concurrency 177
Chapter 14: Successive Renement 193
Chapter 15: JUnit Internals 251
Chapter 16: Refactoring SerialDate 267
Chapter 17: Smells and Heuristics 285
Appendix A:ConcurrencyⅡ
Appendix B:org.jfree.date.SerialDate
Appendix C:Cross References of Heuristics
Epilogue
Index