chapter 1 refactoring, a first example(新增批注共21條) 1
the starting point 2
the first step in refactoring 9
decomposing and redistributing the statement method 10
replacing the conditional logic on price code with polymorphism 30
final thoughts 41
chapter 2 principles in refactoring(新增批注共11條) 43
defining refactoring 43
why should you refactor? 45
when should you refactor? 48
what do i tell my manager? 51
problems with refactoring 53
refactoring and design 57
refactoring and performance 60
where did refactoring come from? 61
chapter 3 bad smells in code (by kent beck and martin fowler)
(新增批注共17條) 65
duplicated code 66
long method 67
large class 70
.long parameter list 71
divergent change 73
shotgun surgery 74
feature envy 74
data clumps 75
primitive obsession 76
switch statements 76
parallel inheritance hierarchies 77
lazy class 77
speculative generality 78
temporary field 78
message chains 79
middle man 81
inappropriate intimacy 82
alternative classes with different interfaces 82
incomplete library class 83
data class 83
refused bequest 84
comments 84
chapter 4 building tests(新增批注共2條) 87
the value of self.testing code 87
the junit testing framework 89
adding more tests 97
chapter 5 toward a catalog of refactorings
(新增批注共1條) 103
format of the refactorings 103
finding references 105
how mature are these refactorings? 106
chapter 6 composing methods(新增批注共9條) 109
extract method 110
inline method 117
inline temp 118
replace temp with query 119
introduce explaining variable 124
split temporary variable 128
remove assignments to parameters 130
replace method with method object 134
substitute algorithm 137
chapter 7 moving features between objects
(新增批注共12條) 139
move method 139
move field 144
extract class 147
inline class 151
hide delegate 153
remove middle man 156
introduce foreign method 158
introduce local extension 160
chapter 8 organizing data(新增批注共9條) 167
self encapsulate field 168
replace data value with object 172
change value to reference 175
change reference to value 179
replace array with object 181
duplicate observed data 186
change unidirectional association to bidirectional 194
change bidirectional association to unidirectional 197
replace magic number with symbolic constant 200
encapsulate field 201
encapsulate collection 202
replace record with data class 211
replace type code with class 211
replace type code with subclasses 217
replace type code with state/strategy 220
replace subclass with fields 225
chapter 9 simplifying conditional expressions
(新增批注共6條) 229
decompose conditional 229
consolidate conditional expression 231
consolidate duplicate conditional fragments 234
remove contr01 flag 236
replace nested conditional with guard clauses 240
replace conditional with polymorphism 245
introduce null object 249
introduce assertion 258
chapter 10 making method calls simpler(新增批注共14條) 263
rename method 264
add parameter 266
remove parameter 267
separate query from modifier 269
parameterize method 273
replace parameter with explicit methods 277
preserve whole object 280
replace parameter with method 283
introduce parameter object 286
remove setting method 293
hide method 296
replace constructor with factory method 297
encapsulate downcast 301
replace error code with exception 303
replace exception with test 308
chapter 11 dealing with generalization(新增批注共6條) 313
pull up field 313
pull up method 315
pull up constructor body 317
push down method 320
push down field 321
extract subclass 322
extract superclass 327
extract interface 331
collapse hierarchy 334
form template method 335
replace inheritance with delegation 342
replace delegation with inheritance 345
chapter 12 big refactorings (by kent beck and martin fowler)
(新增批注共11條) 349
tease apart inheritance 351
convert procedural design to objects 358
separate domain from presentation 363
extract hierarchy 367
chapter 13 refactoring, reuse, and reality (by william opdyke)
(新增批注共8條) 373
a reality check 374
why are developers reluctant to refactor their programs? 375
a reality check (revisited) 388
resources and references for refactoring 389
implications regarding software reuse and technology transfer 390
a final note 391
references 391
chapter 14 refactoring tools (by don roberts and john brant) 395
refactoring with a tool 395
technical criteria for a refactoring tool 397
practical criteria for a refactoring tool 399
wrap up 401
chapter 15 putting it all together (by kent beck)
(新增批注共2條) 403
references 407
list of soundbites 411
index 413
· · · · · · (
收起)