图书介绍

代码整洁之道 英文版PDF|Epub|txt|kindle电子书版本网盘下载

代码整洁之道 英文版
  • (美)ROBERTC.MARTIN著 著
  • 出版社: 北京:人民邮电出版社
  • ISBN:9787115210487
  • 出版时间:2009
  • 标注页数:431页
  • 文件大小:21MB
  • 文件页数:456页
  • 主题词:软件开发 -英文

PDF下载


点此进入-本书在线PDF格式电子书下载【推荐-云解压-方便快捷】直接下载PDF格式图书。移动端-PC端通用
种子下载[BT下载速度快]温馨提示:(请使用BT下载软件FDM进行下载)软件下载地址页直链下载[便捷但速度慢]  [在线试读本书]   [在线获取解压码]

下载说明

代码整洁之道 英文版PDF格式电子书版下载

下载的文件为RAR压缩包。需要使用解压软件进行解压得到PDF格式图书。

建议使用BT下载工具Free Download Manager进行下载,简称FDM(免费,没有广告,支持多平台)。本站资源全部打包为BT种子。所以需要使用专业的BT下载软件进行下载。如BitComet qBittorrent uTorrent等BT下载工具。迅雷目前由于本站不是热门资源。不推荐使用!后期资源热门了。安装了迅雷也可以迅雷进行下载!

(文件页数 要大于 标注页数,上中下等多册电子书除外)

注意:本站所有压缩包均有解压码: 点击下载压缩包解压工具

图书目录

Chapter 1:Clean Code1

There Will Be Code2

Bad Code3

The Total Cost of Owning a Mess4

The Grand Redesign in the Sky5

Attitude5

The Primal Conundrum6

The Art of Clean Code?6

What Is Clean Code?7

Schools of Thought12

We Are Authors13

The Boy Scout Rule14

Prequel and Principles15

Conclusion15

Bibliography15

Chapter 2:Meaningful Names17

Introduction17

Use Intention-Revealing Names18

Avoid Disinformation19

Make Meaningful Distinctions20

Use Pronounceable Names21

Use Searchable Names22

Avoid Encodings23

Hungarian Notation23

Member Prefixes24

Interfaces and Implementations24

Avoid Mental Mapping25

Class Names25

Method Names25

Don't Be Cute26

Pick One Word per Concept26

Don't Pun26

Use Solution Domain Names27

Use Problem Domain Names27

Add Meaningful Context27

Don't Add Gratuitous Context29

Final Words30

Chapter 3:Functions31

Small!34

Blocks and Indenting35

Do One Thing35

Sections within Functions36

One Level of Abstraction per Function36

Reading Code from Top to Bottom:The Stepdown Rule37

Switch Statements37

Use Descriptive Names39

Function Arguments40

Common Monadic Forms41

Flag Arguments41

Dyadic Functions42

Triads42

Argument Objects43

Argument Lists43

Verbs and Keywords43

Have No Side Effects44

Output Arguments45

Command Query Separation45

Prefer Exceptions to Returning Error Codes46

Extract Try/Catch Blocks46

Error Handling Is One Thing47

The Error.java Dependency Magnet47

Don't Repeat Yourself48

Structured Programming48

How Do You Write Functions Like This?49

Conclusion49

SetupTeardownIncluder50

Bibliography52

Chapter 4:Comments53

Comments Do Not Make Up for Bad Code55

Explain Yourself in Code55

Good Comments55

Legal Comments55

Informative Comments56

Explanation of Intent56

Clarification57

Warning of Consequences58

TODO Comments58

Amplification59

Javadocs in Public APIs59

Bad Comments59

Mumbling59

Redundant Comments60

Misleading Comments63

Mandated Comments63

Journal Comments63

Noise Comments64

Scary Noise66

Don't Use a Comment When You Can Use a Function or a Variable67

Position Markers67

Closing Brace Comments67

Attributions and Bylines68

Commented-Out Code68

HTML Comments69

Nonlocal Information69

Too Much Information70

Inobvious Connection70

Function Headers70

Javadocs in Nonpublic Code71

Example71

Bibliography74

Chapter 5:Formatting75

The Purpose of Formatting76

Vertical Formatting76

The Newspaper Metaphor77

Vertical Openness Between Concepts78

Vertical Density79

Vertical Distance80

Vertical Ordering84

Horizontal Formatting85

Horizontal Openness and Density86

Horizontal Alignment87

Indentation88

Dummy Scopes90

Team Rules90

Uncle Bob's Formatting Rules90

Chapter 6:Objects and Data Structures93

Data Abstraction93

Data/Object Anti-Symmetry95

The Law of Demeter97

Train Wrecks98

Hybrids99

Hiding Structure99

Data Transfer Objects100

Active Record101

Conclusion101

Bibliography101

Chapter 7:Error Handling103

Use Exceptions Rather Than Return Codes104

Write Your Try-Catch-Finally Statement First105

Use Unchecked Exceptions106

Provide Context with Exceptions107

Define Exception Classes in Terms of a Caller's Needs107

Define the Normal Flow109

Don't Return Null110

Don't Pass Null111

Conclusion112

Bibliography112

Chapter 8:Boundaries113

Using Third-Party Code114

Exploring and Learning Boundaries116

Learning log4j116

Learning Tests Are Better Than Free118

Using Code That Does Not Yet Exist118

Clean Boundaries120

Bibliography120

Chapter 9:Unit Tests121

The Three Laws of TDD122

Keeping Tests Clean123

Tests Enable the -ilities124

Clean Tests124

Domain-Specific Testing Language127

A Dual Standard127

One Assert per Test130

Single Concept per Test131

F.I.R.S.T132

Conclusion133

Bibliography133

Chapter 10:Classes135

Class Organization136

Encapsulation136

Classes Should Be Small!136

The Single Responsibility Principle138

Cohesion140

Maintaining Cohesion Results in Many Small Classes141

Organizing for Change147

Isolating from Change149

Bibliography151

Chapter 11:Systems153

How Would You Build a City?154

Separate Constructing a System from Using It154

Separation of Main155

Factories155

Dependency Injection157

Scaling Up157

Cross-Cutting Concerns160

Java Proxies161

Pure Java AOP Frameworks163

AspectJ Aspects166

Test Drive the System Architecture166

Optimize Decision Making167

Use Standards Wisely,When They Add Demonstrable Value168

Systems Need Domain-Specific Languages168

Conclusion169

Bibliography169

Chapter 12:Emergence171

Getting Clean via Emergent Design171

Simple Design Rule 1:Runs All the Tests172

Simple Design Rules 2-4:Refactoring172

No Duplication173

Expressive175

Minimal Classes and Methods176

Conclusion176

Bibliography176

Chapter 13:Concurrency177

Why Concurrency?178

Myths and Misconceptions179

Challenges180

Concurrency Defense Principles180

Single Responsibility Principle181

Corollary:Limit the Scope of Data181

Corollary:Use Copies of Data181

Corollary:Threads Should Be as Independent as Possible182

Know Your Library182

Thread-Safe Collections182

Know Your Execution Models183

Producer-Consumer184

Readers-Writers184

Dining Philosophers184

Beware Dependencies Between Synchronized Methods185

Keep Synchronized Sections Small185

Writing Correct Shut-Down Code Is Hard186

Testing Threaded Code186

Treat Spurious Failures as Candidate Threading Issues187

Get Your Nonthreaded Code Working First187

Make Your Threaded Code Pluggable187

Make Your Threaded Code Tunable187

Run with More Threads Than Processors188

Run on Different Platforms188

Instrument Your Code to Try and Force Failures188

Hand-Coded189

Automated189

Conclusion190

Bibliography191

Chapter 14:Successive Refinement193

Args Implementation194

How Did I Do This?200

Args:The Rough Draft201

So I Stopped212

On Incrementalism212

String Arguments214

Conclusion250

Chapter 15:JUnit Internals251

The JUnit Framework252

Conclusion265

Chapter 16:Refactoring SerialDate267

First,Make It Work268

Then Make It Right270

Conclusion284

Bibliography284

Chapter 17:Smells and Heuristics285

Comments286

C1:Inappropriate Information286

C2:Obsolete Comment286

C3:Redundant Comment286

C4:Poorly Written Comment287

C5:Commented-Out Code287

Environment287

E1:Build Requires More Than One Step287

E2:Tests Require More Than One Step287

Functions288

F1:Too Many Arguments288

F2:Output Arguments288

F3:Flag Arguments288

F4:Dead Function288

General288

G1:Multiple Languages in One Source File288

G2:Obvious Behavior Is Unimplemented288

G3:Incorrect Behavior at the Boundaries289

G4:Overridden Safeties289

G5:Duplication289

G6:Code at Wrong Level of Abstraction290

G7:Base Classes Depending on Their Derivatives291

G8:Too Much Information291

G9:Dead Code292

G10:Vertical Separation292

G11:Inconsistency292

G12:Clutter293

G13:Artificial Coupling293

G14:Feature Envy293

G15:Selector Arguments294

G16:Obscured Intent295

G17:Misplaced Responsibility295

G18:Inappropriate Static296

G19:Use Explanatory Variables296

G20:Function Names Should Say What They Do297

G21:Understand the Algorithm297

G22:Make Logical Dependencies Physical298

G23:Prefer Polymorphism to If/Else or Switch/Case299

G24:Follow Standard Conventions299

G25:Replace Magic Numbers with Named Constants300

G26:Be Precise301

G27:Structure over Convention301

G28:Encapsulate Conditionals301

G29:Avoid Negative Conditionals302

G30:Functions Should Do One Thing302

G31:Hidden Temporal Couplings302

G32:Don't Be Arbitrary303

G33:Encapsulate Boundary Conditions304

G34:Functions Should Descend Only One Level of Abstraction304

G35:Keep Configurable Data at High Levels306

G36:Avoid Transitive Navigation306

Java307

J1:Avoid Long Import Lists by Using Wildcards307

J2:Don't Inherit Constants307

J3:Constants versus Enums308

Names309

N1:Choose Descriptive Names309

N2:Choose Names at the Appropriate Level of Abstraction311

N3:Use Standard Nomenclature Where Possible311

N4:Unambiguous Names312

N5:Use Long Names for Long Scopes312

N6:Avoid Encodings312

N7:Names Should Describe Side-Effects313

Tests313

T1:Insufficient Tests313

T2:Use a Coverage Tool!313

T3:Don't Skip Trivial Tests313

T4:An Ignored Test Is a Question about an Ambiguity313

T5:Test Boundary Conditions314

T6:Exhaustively Test Near Bugs314

T7:Patterns of Failure Are Revealing314

T8:Test Coverage Patterns Can Be Revealing314

T9:Tests Should Be Fast314

Conclusion314

Bibliography315

Appendix A:Concurrency Ⅱ317

Client/Server Example317

The Server317

Adding Threading319

Server Observations319

Conclusion321

Possible Paths of Execution321

Number of Paths322

Digging Deeper323

Conclusion326

Knowing Your Library326

Executor Framework326

Nonblocking Solutions327

Nonthread-Safe Classes328

Dependencies Between Methods Can Break Concurrent Code329

Tolerate the Failure330

Client-Based Locking330

Server-Based Locking332

Increasing Throughput333

Single-Thread Calculation of Throughput334

Multithread Calculation of Throughput335

Deadlock335

Mutual Exclusion336

Lock&Wait337

No Preemption337

Circular Wait337

Breaking Mutual Exclusion337

Breaking Lock&Wait338

Breaking Preemption338

Breaking Circular Wait338

Testing Multithreaded Code339

Tool Support for Testing Thread-Based Code342

Conclusion342

Tutorial:Full Code Examples343

Client/Server Nonthreaded343

Client/Server Using Threads346

Appendix B:org.jfree.date.SerialDate349

Appendix C:Cross References of Heuristics409

Epilogue411

Index413

热门推荐