[Code Neat Way]. (US) Martin. Scanned version pdf

Source: Internet
Author: User
Tags data structures define exception error code error handling html comment
Download Address: Download the network disk
Content Profile ...

Software quality depends not only on the architecture and project management, but also on the quality of the code. This, whether it is the agile development genre or the traditional development genre, have to admit.

This book puts forward the idea that code quality is proportional to its cleanliness. Clean code, not only in the quality of more reliable, but also for later maintenance, upgrade laid a good foundation. As a leader in the field of programming, the authors of this book provide a series of effective and neat code practices. These practices are embodied in this book as a rule (or "revelation"), supplemented by positive and inverse examples from real projects. As long as you follow these rules, you can write clean code to improve the quality of your code effectively.

This book is read for programmers and technical managers who are interested in improving the quality of their code. The rules introduced in the book come from the author's many years of practical experience, covering many programming aspects from naming to refactoring, although it is a "home" word, but Prudential has the value for reference. Author Profile ...

Rober C. Martin,object Mentor, president of the company. Senior Consultant in the field of object-oriented design, pattern, UML, agile methodology and extreme programming. He is designing object-oriented c++applications Using the Boochmethod and Jolt Award winning book Agile Softwaredevelopment,principles, Pattems,and Practices (Chinese version of "Agile Software Development: principles, patterns and practices") and other best-selling authors.Catalog ...1th. Clean Code 1
1.1 To have code 2
1.2 Bad Code 2
1.3 The cost of Chaos 3
1.3.1 Gorgeous new Design 4
1.3.2 Attitude 4
1.3.3 Puzzle 5
1.3.4 The art of neat code 5
1.3.5 What is neat code 6
1.4 Schools of thought 10
1.5 We are the author 11
1.6 Scout 12
1.7 Prequel and Principle 12
1.8 Summary 12
1.9 References 13
2nd. Meaningful naming 15
2.1 Introduction 15
2.2 Deputy actually 16
2.3 Avoid misleading 17
2.4 Make a meaningful distinction 18
2.5 using the read-out name 19
2.6 Using a searchable name 20
2.7 To avoid using code 21
2.7.1 Hungarian notation 21
2.7.2 member prefix 21
2.7.3 interface and implementation 22
2.8 Avoiding Thinking Maps 22
2.9 Class name 23
2.10 Method Name 23
2.11 Don't pretend to be cute 23
2.12 Each concept corresponds to one word 24
2.13 Don't use puns 24
2.14 Using the solution realm name 25
2.15 Use of names originating from the problem areas covered 25
2.16 Adding a meaningful context 25
2.17 do not add a useless context 27
2.18 Last Words 27
3rd Chapter Function 29
3.1 Short 32
3.2 Do one thing 33
3.3 An abstraction level of each function 34
3.4 Switch Statement 35
3.5 using a descriptive name 36
3.6 Function Parameters 37
3.6. General form of 11-tuple function 38
3.6.2 Identification Parameter 38
3.6.32-Tuple function 38
3.6.43-Tuple Function 39
3.6.5 Parameter Object 39
3.6.6 parameter List 40
3.6.7 Verbs and Keywords 40
3.7 No side effects 40
3.8 Separating instructions and asking 42
3.9 using exception substitution to return error code 42
3.9.1 pulling away from Try/catch code block 43
3.9.2 error handling is one thing. 44
3.9.3 Error.java Dependent Magnet 44
3.10 Don't repeat yourself 44
3.11 Structured Programming 45
3.12 How to write such a function 45
3.13 Summary 45
3.14 Setupteardownincluder Program 46
3.15 References 48
4th. Note 49
4.1 Comments do not beautify the bad code 50
4.2 Using code to illustrate 51
4.3 Good notes 51
4.3.1 Legal Information 51
4.3.2 Notes on providing information 51
4.3.3 interpretation of the intention 52
4.3.4 Interpretation 53
4.3.5 Warning 53
4.3.6 Todo Note 54
4.3.7 Magnification 54
4.3.8 Javadoc 55 in the public API
4.4 Bad Notes 55
4.4.1 Mumbling 55
4.4.2 Extra Notes 56
4.4.3 Misleading Note 58
4.4.4 Follow-up note 58
4.4.5 Log Comment 59
4.4.6 Nonsense Note 59
4.4.7 horrible Crap 61
4.4.8 When you can use a function or variable, do not use comment 62
4.4.9 Position Marker 62
Note 62 after the 4.4.10 bracket
4.4.11 Attribution and Attribution 63
4.4.12 commented out Code 63
4.4.13 HTML Comment 64
4.4.14 non-local information 64
4.4.15 Too much information 65
4.4.16 non-obvious contact 65
4.4.17 Function Header 66
4.4.18 Javadoc 66 in non-public code
4.4.19 Example 66
4.5 References 69
5th Chapter Format 71
5.1 Purpose of the format 72
5.2 Vertical Format 72
5.2.1 to the newspaper 73
5.2.2 73 in the vertical direction between concepts
5.2.3 in the vertical direction near 74
5.2.4 Vertical Distance 75
5.2.5 Vertical Order 79
5.3 Landscape Format 79
5.3.1 in horizontal direction and close to 80
5.3.2 Horizontal Alignment 81
5.3.3 Indent 82
5.3.4 Empty Range 84
5.4 Team rules 84
5.5 Uncle Bob's formatting rules 85
Chapter 6th objects and data Structures 87
6.1 Data Abstraction 87
6.2 Inverse symmetry of data and objects 89
6.3 Artemis 91
6.3.1 Train Wreck 91
6.3.2 Hybrid 92
6.3.3 Hidden Structure 92
6.4 Data Transfer Objects 93
6.5 Summary 94
6.6 References 94
Chapter 7th error Handling 95
7.1 Use exception instead of return code 96
7.2 Write first try-catch-finally statement 97
7.3 Using an uncontrolled exception 98
7.4 Description of the environment in which the exception occurred 99
7.5 Define exception class according to caller 99
7.6 Defining the general process 100
7.7 Do not return null value 101
7.8 do not pass null value 102
7.9 Summary 103
7.10 References 104
Chapter 8th Boundary 105
8.1 Using third-party code 106
8.2 Browsing and learning boundaries 107
8.3 Learning log4j 108
8.4 The benefits of a learning test are not just free 110
8.5 Using code that does not already exist 110
8.6 Tidy borders 111
8.7 References 112
9th Unit Test 113
9.1 TDD Three Laws 114
9.2 Keeping tests Neat 115
9.3 Neat Test 116
9.3.1 test language for a specific domain 118
9.3.2 double standard 119
9.4 One assertion per test 121
9.5 f.i.r.s.t. 122
9.6 Summary 123
9.7 References 124
Chapter 10th Class 125
Organization of Class 10.1 126
Class 10.2 should be short 126
10.2.1 Single Responsibility Principle 128
10.2.2 Poly 129
10.2.3 maintain cohesion will get a lot of short class 130
10.3 Organization for Modification 136
10.4 References 139
Chapter 11th System 141
11.1 How to build a city 142
11.2 Separating the construction and use of the system 142
11.2.1 Decomposition main 143
11.2.2 Plant 143
11.2.3 Dependency Injection 144
11.3 Expansion 145
11.4 Java Agent 148
11.5 Pure Java AOP Framework 150
Aspects of 11.6 ASPECTJ 152
11.7 Test Drive System Architecture 153
11.8 Optimization Decisions 154
11.9 wise use adds demonstrable value to the standard 154
11.10 system requires domain-specific language 154
11.11 Summary 155
11.12 References 155
The 12th chapter iterates 157
12.1 by iterative design to achieve neat purpose 157
12.2 Simple Design Rule 1: Run all tests 158
12.3 Simple Design Rules: Refactoring 158
12.4 Non-repeatable 159
12.5 Expression Force 161
12.6 classes and methods as few as possible 162
12.7 Summary 162
12.8 References 162
The 13th Chapter concurrent Programming 163
13.1 Why concurrent 164
13.2 Challenge 165
13.3 Concurrent Defense Principle 166
13.3.1 Single Responsibility Principle 166
13.3.2 inference: Limiting data scope 166
13.3.3 inference: Using a copy of the data 167
13.3.4 Inference: Threads should be as independent as possible 167
13.4 Understanding Java Library 167
13.5 Understanding the Execution Model 168
13.5.1 Producer-Consumer model 169
13.5.2 Reader-author Model 169
13.5.3 Banquet Philosopher 169
13.6 Beware of dependencies between synchronization methods 169
13.7 Keeping the sync area tiny 170
13.8 hard to write correct close code 170
13.9 Test Thread Code 171
13.9.1 pseudo-Failure as a possible threading issue 171
13.9.2 Enable non-threading code to work 171
13.9.3 Writing pluggable Thread code 172
13.9.4 writing an adjustable thread code 172
13.9.5 threads running more than the number of processors 172
13.9.6 running on different platforms 172
13.9.7 Device trial error code 173
13.9.8 Hard-coded 173
13.9.9 Automation 174
13.10 Summary 175
13.11 References 175
Chapter 14th Progressive Improvement 176
Implementation of 14.1 args 177
14.2 Args: Draft 183
14.2.1 so I paused for 195
14.2.2 Progressive 195
14.3 string Parameter 197
14.4 Summary 234
Chapter 15th JUnit Insider 235
15.1 JUnit Framework 236
15.2 Summary 249
16th Chapter 251 Reconstruction Serialdate
16.1 First, let it work 252
16.2 Let it do to 254
16.3 Summary 266
16.4 References 267
17th Chapter Flavor and Inspiration 269
17.1 Notes 270
17.2 Environment 271
17.3 Functions 271
17.4 General Questions 272
17.5 Java 288
17.6 name 291
17.7 Test 294
17.8 Summary 295
17.9 References 296
Appendix A concurrent Programming II 297
A.1 Example of client/server 297
a.1.1 Server 297
a.1.2 adding thread code 298
a.1.3 Viewing server Side 299
a.1.4 Summary 301
Possible paths for A.2 execution 301
Number of a.2.1 paths 302
a.2.2 Digging Deeper 303
a.2.3 Summary 305
A.3 Understanding Class Library 305
a.3.1 Executor Frame 305
a.3.2 Non-locking solution 306
a.3.3 Non-Threading security class 307
Dependencies between A.4 methods can break concurrency code 308
a.4.1 Tolerance Error 309
a.4.2 based on customer code lock 309
a.4.3 based on service-side lockout 311
A.5 Boost Throughput 312
a.5.1 throughput under single-threaded conditions 313
a.5.2 throughput under multi-threaded conditions 313
A.6 Deadlock 314
a.6.1 Mutex 315
a.6.2 Lock and wait 315
a.6.3 No preemptive mechanism 315
a.6.4 Cycle Wait 315
a.6.5 not mutually exclusive 316
a.6.6 not locked and wait 316
a.6.7 satisfies the preemptive mechanism 317
a.6.8 do not cycle wait 317
A.7 Testing Multithreaded Code 317
A.8 tool support for testing thread code 320
A.9 Summary 320
A.10 Tutorial: Complete code example 321
a.10.1 client/server non-thread code 321
a.10.2 client/server code with thread 324
Appendix B org.jfree.date.SerialDate 327
Concluding remarks 389

Download Address: Download the network disk

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.