出版時間:2011-6 出版社:電子工業(yè)出版社 作者:Martin Fowler Kent Beck John Brant William Opdyke Don Roberts 頁數(shù):425 譯者:張逸 評注
Tag標簽:無
內(nèi)容概要
重構,一言以蔽之,就是在不改變外部行為的前提下,有條不紊地改善代碼。多年前,正是本書原版的出版,使重構終于從編程高手們的小圈子走出,成為眾多普通程序員日常開發(fā)工作中不可或缺的一部分。本書也因此成為與《設計模式》齊名的經(jīng)典著作,被譯為中、德、俄、日等眾多語言,在世界范圍內(nèi)暢銷不衰。
本書凝聚了軟件開發(fā)社區(qū)專家多年摸索而獲得的寶貴經(jīng)驗,擁有不因時光流逝而磨滅的價值。今天,無論是重構本身,業(yè)界對重構的理解,還是開發(fā)工具對重構的支持力度,都與本書最初出版時不可同日而語,但書中所蘊涵的意味和精華,依然值得反復咀嚼,而且往往能夠常讀常新。
本評注版力邀國內(nèi)資深專家執(zhí)筆,在英文原著基礎上增加中文點評與注釋,旨在以先行者的學研心得與實踐感悟,對讀者閱讀與學習加以點撥、指明捷徑。
作者簡介
Martin
Fowler世界級軟件開發(fā)大師,在面向?qū)ο蠓治鲈O計、UML、模式、XP和重構等領域都有卓越貢獻,曾任著名軟件開發(fā)咨詢公司ThoughtWorks的首席科學家。他的多部著作《分析模式》、《UML精悴》和《企業(yè)應用架構模式》等都已經(jīng)成為膾炙人口的經(jīng)典。
書籍目錄
Chapter 1 Refactoring, a First Example(新增批注共21條)
The Starting Point
The First Step in Refactoring
Decomposing and Redistributing the Statement Method
Replacing the Conditional Logic on Price Code with
Polymorphism
Final Thoughts
Chapter 2 Principles in Refactoring(新增批注共10條)
Defining Refactoring
Why Should You Refactor?
When Should You Refactor?
What DO I Tell My Manager?
Problems with Refactoring
Refactoring and Design
Refactoring and Performance
Where Did Refactoring Come From?
Chapter 3 Bad Smells in Code (by Kent Beck and Martin
Fowler)(新增批注共17條)
Duplicated Code
Long Method
Large Class
Long Parameter List
Divergent Change
Shotgun Surgery
Feature Envy
Data Clumps
Primitive Obsession
Switch Statements
Parallel Inheritance Hierarchies
Lazy Class
Speculative Generality
Temporary Field
Message Chains
Middle Man
Inappropriate Intimacy
Alternative Classes with Different Interfaces
Incomplete Library Class
Data Class
Refused Bequest
Comments
Chapter 4 Building Tests(新增批注共2條)
The Value of Self.testing Code
The JUnit Testing Framework
Adding More Tests
Chapter 5 Toward a Catalog of Refactorings(新增批注共1條)
Format of the Refactorings
Finding References
How Mature Are These Refactorings?
Chapter 6 Composing Methods(新增批注共7條)
Extract Method11O
Inline Method
Inline Temp
Replace Temp with Query
Introduce Explaining Variable
Split Temporary Variable
Remove Assignments to Parameters
Replace Method with Method Object
Substitute Algorithm
Chapter 7 Moving Features Between Objects(新增批注共11條)
Move Method
Move Field
Extract Class
Inline Class
Hide Delegate
Remove Middle Man
Introduce Foreign Method
Introduce Local Extension
Chapter 8 Organizing Data(新增批注共9條)
Self Encapsulate Field
Replace Data Value with Object
Change Value to Reference
Change Reference to Value
Replace Array with Object
Duplicate Observed Data
Change Unidirectional Association to Bidirectional
Change Bidirectional Association to Unidirectional
Replace Magic Number with Symbolic Constant
Encapsulate Field
Encapsulate Collection
Replace Record with Data Class
Replace Type Code with Class
Replace Type Code with Subclasses
Replace Type Code with StateStrategy
Replace Subclass with Fields
Chapter 9 Simplifying Conditional Expressions(新增批注共6條)
Decompose Conditional
Consolidate Conditional Expression
Consolidate Duplicate Conditional Fragments
Remove Contr01 Flag
Replace Nested Conditional with Guard Clauses
Replace Conditional with Polymorphism
Introduce Null Object
Introduce Assertion
Chapter 10 Making Method Calls Simpler(新增批注共13條)
Rename Method
Add Parameter
Remove Parameter
Separate Query from Modifier
Parameterize Method
Replace Parameter with Explicit Methods
Preserve Whole Object
Replace Parameter with Method
Introduce Parameter Object
Remove Setting Method
Hide Method
Replace Constructor with Factory Method
Encapsulate Downcast
Replace Error Code with Exception
Replace Exception With Test
Chapter 11 Dealing with Generalization(新增批注共6條)
Pull Up Field
Pull Up Method
Pull Up Constructor Body
Push Down Method
Push Down Field
Extract Subclass
Extract Superclass
Extract Interface
Collapse Hierarchy
Form Template Method
Replace Inheritance with Delegation
Replace Delegation with Inheritance
Chapter 12 Big Refactorings (By Kent Beck and Martin
Fowler)(新增批注共11條)
Tease Apart Inheritance
Convert Procedural Design to Objects
Separate Domain from Presentation
Extract Hierarchy
Chapter 13 Refactoring, Reuse, and Reality (by William
Opdyke)(新增批注共8條)
A Reality Check
Why Are Developers Reluctant to Refactor Their
Programs?
A Reality Check (Revisited)
Resources and References for Refactoring
Implications Regarding Software Reuse and Technology
Transfer
A Final Note
References
Chapter 14 Refactoring Tools (by Don Roberts and John
Brant)
Refactoring with a Tool
Technical Criteria for a Refactoring Tool
Practical Criteria for a Refactoring Tool
Wrap Up
Chapter 15 Putting It All Together (by Kent
Beck)(新增批注共2條)
References
List of Soundbites
Index
編輯推薦
Martin Fowler和本書另幾位作者清楚揭示了重構過程,他們?yōu)槊嫦驅(qū)ο筌浖_發(fā)所做的貢獻難以衡量。《重構——改善既有代碼的設計(評注版)》解釋了重構的原理和最佳實踐,并指出何時何地你應該開始挖掘你的代碼以求改善。本書的核心是一系列完整的重構方法,其中每一項都介紹一種經(jīng)過實踐檢驗的代碼變換手法的動機和技術。某些項目如Extract Method和Move Field看起來可能很淺顯,但不要掉以輕心,因為理解這類技術正是有條不紊地進行重構的關鍵。本書所提的這些重構手法將幫助你一次一小步地修改你的代碼,這就減少了過程中的風險。很快你就會把這些重構手法和其名稱加入自己的開發(fā)詞典中,并且朗朗上口。
圖書封面
圖書標簽Tags
無
評論、評分、閱讀與下載