注冊 | 登錄讀書好,好讀書,讀好書!
讀書網(wǎng)-DuShu.com
當前位置: 首頁出版圖書科學技術(shù)計算機/網(wǎng)絡軟件工程及軟件方法學重構(gòu):改善既有代碼的設計(英文版)

重構(gòu):改善既有代碼的設計(英文版)

重構(gòu):改善既有代碼的設計(英文版)

定 價:¥69.00

作 者: (美)福勒 著
出版社: 人民郵電出版社
叢編項:
標 簽: 軟件工程/開發(fā)項目管理

ISBN: 9787115239143 出版時間: 2010-11-01 包裝: 平裝
開本: 16開 頁數(shù): 431 字數(shù):  

內(nèi)容簡介

  本書清晰揭示了重構(gòu)的過程,解釋了重構(gòu)的原理和最佳實踐方式,并給出了何時以及何地應該開始挖掘代碼以求改善。書中給出了70多個可行的重構(gòu),每個重構(gòu)都介紹了一種經(jīng)過驗證的代碼變換手法的動機和技術(shù)。本書提出的重構(gòu)準則將幫助你一次一小步地修改你的代碼,從而減少了開發(fā)過程中的風險。本書適合軟件開發(fā)人員、項目管理人員等閱讀,也可作為高等院校計算機及相關(guān)專業(yè)師生的參考讀物。

作者簡介

  Martin Fowler是一位獨立咨詢顧問,他運用對象技術(shù)解決企業(yè)問題已經(jīng)超過十年。他的顧問領(lǐng)域包括健康管理、金融貿(mào)易,以及法人財務。他的客戶包括Chrysler,Citibank,UK National Health Service,AndersenConsulting,NetscapeCommunications。此外Fowler也是objects、UML、patterns技術(shù)的一位合格講師,他是《AnalysisPatterns》和《UML Distilled》的作者。

圖書目錄

Chapter 1: Refactoring, a First Example 1
 The Starting Point 1
 The First Step in Refactoring 7
 Decomposing and Redistributing the Statement Method 8
 Replacing the Conditional Logic on Price Code with Polymorphism 34
 Final Thoughts 52
Chapter 2: Principles in Refactoring 53
 Defining Refactoring 53
 Why Should You Refactor 55
 When Should You Refactor 57
 What Do I Tell My Manager 60
 Problems with Refactoring 62
 Refactoring and Design 66
 Refactoring and Performance 69
 Where Did Refactoring Come From 71
Chapter 3: Bad Smells in Code (by Kent Beck and Martin Fowler) 75
 Duplicated Code 76
 Long Method 76
 Large Class 78
 Long Parameter List 78
 Divergent Change 79
 Shotgun Surgery 80
 Feature Envy 80
 Data Clumps 81
 Primitive Obsession 81
 Switch Statements 82
 Parallel Inheritance Hierarchies 83
 Lazy Class 83
 Speculative Generality 83
 Temporary Field 84
 Message Chains 84
 Middle Man 85
 Inappropriate Intimacy 85
 Alternative Classes with Different Interfaces 85
 Incomplete Library Class 86
 Data Class 86
 Refused Bequest 87
 Comments 87
Chapter 4: Building Tests 89
 The Value of Self-testing Code 89
 The JUnit Testing Framework 91
 Adding More Tests 97
Chapter 5: Toward a Catalog of Refactorings 103
 Format of the Refactorings 103
 Finding References 105
 How Mature Are These Refactorings 106
Chapter 6: Composing Methods 109
 Extract Method 110
 Inline Method 117
 Inline Temp 119
 Replace Temp with Query 120
 Introduce Explaining Variable 124
 Split Temporary Variable 128
 Remove Assignments to Parameters 131
 Replace Method with Method Object 135
 Substitute Algorithm 139
Chapter 7: Moving Features Between Objects 141
 Move Method 142
 Move Field 146
 Extract Class 149
 Inline Class 154
 Hide Delegate 157
 Remove Middle Man 160
 Introduce Foreign Method 162
 Introduce Local Extension 164
Chapter 8: Organizing Data 169
 Self Encapsulate Field 171
 Replace Data Value with Object 175
 Change Value to Reference 179
 Change Reference to Value 183
 Replace Array with Object 186
 Duplicate Observed Data 189
 Change Unidirectional Association to Bidirectional 197
 Change Bidirectional Association to Unidirectional 200
 Replace Magic Number with Symbolic Constant 204
 Encapsulate Field 206
 Encapsulate Collection 208
 Replace Record with Data Class 217
 Replace Type Code with Class 218
 Replace Type Code with Subclasses 223
 Replace Type Code with State/Strategy 227
 Replace Subclass with Fields 232
Chapter 9: Simplifying Conditional Expressions 237
 Decompose Conditional 238
 Consolidate Conditional Expression 240
 Consolidate Duplicate Conditional Fragments 243
 Remove Control Flag 245
 Replace Nested Conditional with Guard Clauses 250
 Replace Conditional with Polymorphism 255
 Introduce Null Object 260
 Introduce Assertion 267
Chapter 10: Making Method Calls Simpler 271
 Rename Method 273
 Add Parameter 275
 Remove Parameter 277
 Separate Query from Modifier 279
 Parameterize Method 283
 Replace Parameter with Explicit Methods 285
 Preserve Whole Object 288
 Replace Parameter with Method 292
 Introduce Parameter Object 295
 Remove Setting Method 300
 Hide Method 303
 Replace Constructor with Factory Method 304
 Encapsulate Downcast 308
 Replace Error Code with Exception 310
 Replace Exception with Test 315
Chapter 11: Dealing with Generalization 319
 Pull Up Field 320
 Pull Up Method 322
 Pull Up Constructor Body 325
 Push Down Method 328
 Push Down Field 329
 Extract Subclass 330
 Extract Superclass 336
 Extract Interface 341
 Collapse Hierarchy 344
 Form Template Method 345
 Replace Inheritance with Delegation 352
 Replace Delegation with Inheritance 355
Chapter 12: Big Refactorings (by Kent Beck and Martin Fowler) 359
 Tease Apart Inheritance 362
 Convert Procedural Design to Objects 368
 Separate Domain from Presentation 370
 Extract Hierarchy 375
Chapter 13: Refactoring, Reuse, and Reality (by William Opdyke) 379
 A Reality Check 380
 Why Are Developers Reluctant to Refactor Their Programs 381
 A Reality Check (Revisited) 394
 Resources and References for Refactoring 394
 Implications Regarding Software Reuse and Technology Transfer 395
 A Final Note 397
 References 397
Chapter 14: Refactoring Tools (by Don Roberts and John Brant) 401
 Refactoring with a Tool 401
 Technical Criteria for a Refactoring Tool 403
 Practical Criteria for a Refactoring Tool 405
 Wrap Up 407
Chapter 15: Putting It All Together (by Kent Beck) 409
References 413
List of Soundbites 417
Index 419

本目錄推薦

掃描二維碼
Copyright ? 讀書網(wǎng) ranfinancial.com 2005-2020, All Rights Reserved.
鄂ICP備15019699號 鄂公網(wǎng)安備 42010302001612號