代码整洁之道(英文版)

代码整洁之道(英文版)
作 者: 马丁
出版社: 人民邮电出版社
丛编项: 典藏原版书苑
版权说明: 本书为出版图书,暂不支持在线阅读,请支持正版图书
标 签: 软件工程/开发项目管理
ISBN 出版时间 包装 开本 页数 字数
未知 暂无 暂无 未知 0 暂无

作者简介

  RObert C.Ma rlin,(Bob大叔)自1970年进入软件行业,从1990年起成为国际软件咨询师。他是Object Mentor公司的创始人和总裁。Object Mentor:是由一群经验丰富的咨询师组成的公司,他们的客户遍及全世界。业务涉及C++、.Java、C#、Ruby、面向对象、设计模式、UML、敏捷方法论和极限编程等领域。

内容简介

软件质量,不但依赖于架构及项目管理,而且与代码质量紧密相关。这一点,无论是敏捷开发流派还是传统开发流派,都不得不承认。《代码整洁之道(英文版)》提出一种观念:代码质量与其整洁度成正比。干净的代码,既在质量上较为可靠,也为后期维护、升级奠定了良好基础。作为编程领域的佼佼者,《代码整洁之道(英文版)》作者给出了一系列行之有效的整洁代码操作实践。这些实践在《代码整洁之道(英文版)》中体现为一条条规则(或称“启示”),并辅以来自现实项目的正、反两面的范例。只要遵循这些规则,就能编写出干净的代码,从而有效提升代码质量。《代码整洁之道(英文版)》阅读对象为一切有志于改善代码质量的程序员及技术经理。书中介绍的规则均来自作者多年的实践经验,涵盖从命名到重构的多个编程方面,虽为一“家”之言,然诚有可资借鉴的价值。

图书目录

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