
| “这《重构:改善既有代码的设计》之于重构就相当于韵谱之于作诗。一个翻着韵书作诗的诗人一定是蹩脚的,但好的诗人却要对那109个韵部了然于胸;同样,一个好的程序员要求能够主动自然地重构代码,虽不应翻着重构手册干活,但需对《重构:改善既有代码的设计》中提到的70多个重构方法成竹在胸。然而,在达到这一境界之前,需要不断的实践和经验积累,并且要先读读Fowler的这《重构:改善既有代码的设计》。” “一口气读完了这《重构:改善既有代码的设计》,感觉书中作者对代码的整理不像是一种技术,更像是一种艺术。” “太经典了,看这《重构:改善既有代码的设计》真有醍醐灌顶的感觉。” “处于金字塔顶部的书不多,而这一《重构:改善既有代码的设计》恰恰就是,很幸运我看到了它。” “这《重构:改善既有代码的设计》本质上是向我们推荐了一种优秀的编程习惯和编程态度。在领会《重构:改善既有代码的设计》思想的同时,我们也应该培养一种精益求精的工作态度,探索一条更适合自己的重构道路。” “今年已经看了两遍,每次都有很大的收获。特别喜欢其中对其他章节的索引,当你把它作为一个手边随时翻阅的参考书看时,它不知不觉引导你读了很多内容,问题也在不知不觉中有了求解思路,最终得以解决。” “不要写完代码就束之高阁,适当地优化代码结构,能够为以后的开发带来许多方便,这《重构:改善既有代码的设计》就向你介绍了这方面的技巧,说得非常详细。” “程序几乎离不开重构,但如何更加迅速有效地重构却一直没有系统性的指导。《重构:改善既有代码的设计》就是这样的经典巨著,有了它,重构不再烦琐!”软件开发的不朽经典,生动阐述重构原理和具体做法,普通程序员进阶到编程高手必须修炼的秘笈。重构,一言以蔽之,就是在不改变外部行为的前提下,有条不紊地改善代码。多年前,正是《重构:改善既有代码的设计》原版的出版,使重构终于从编程高手们的小圈子走出,成为众多普通程序员日常开发工作中不可或缺的一部分。《重构:改善既有代码的设计》也因此成为与《设计模式》齐名的经典著作,被译为中、德、俄、日等众多语言,在世界范围内畅销不衰。《重构:改善既有代码的设计》凝聚了软件开发社区专家多年摸索而获得的宝贵经验,拥有不因时光流逝而磨灭的价值。今天,无论是重构本身,业界对重构的理解,还是开发工具对重构的支持力度,都与《重构:改善既有代码的设计》最初出版时不可同日而语,但书中所蕴涵的意味和精华,依然值得反复咀嚼,而且往往能够常读常新。 |
| Martin Fowler 世界软件开发大师,在面向对象分析设计、UML、模式、XP和重构等领域都有卓越贡献,现为著名软件开发咨询公司ThoughtWorks的首席科学家。他的多部著作《分析模式》、《UML精粹》和《企业应用架构模式》等都已经成为脍炙人口的经典。 其他参编者—— Kent Beck 软件开发方法学的泰斗,极限编程的创始人。他是Three Rivers Institute公司总裁,也是Agitar Software的成员。 John Brant和Don Roberts The Refactory公司的创始人,Refactoring Browser (http://st-www.cs.illinois.edu/users/brant/Refactory/)的开发者,多年来一直从事研究重构的实践与理论。 William Opdyke 目前在朗讯贝尔实验室工作,他写的关于面向对象框架的博士论文是重构方面的第一篇著名文章。 |
| chapter 1:refactoring,a first example 重构,第一个例子 the starting point 起点 the first step in refactoring 重构第一步 decomposing and redistributing the statement method 分解并重组slalemenl方法 replacing the conditional logic on price code with polymorphism 用多态代替价格条件逻辑代码 final thoughts 结语 chapter 2:principles in refactoring 重构原则 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) 代码坏昧 duplicated code 重复代码 long method 过长方法 large class 过长类 long parameter list 过长参数列表 divergent change 发散式变化 shotgun surgery 霰弹式修改 feature envy 特性依恋 data clumps 数据泥团 primitive obsession 基本类型偏执 switch statements switch语句 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 构建测试 the value of self-testing code 自测试代码的重要性 the junit testing framework junit测试框架 adding more tests 添加更多测试 chapter 5:toward a catalog of refactorings 重构目录 format of the refactorings 重构描述的格式 finding references 寻找引用 how mature are these refactorings? 这些重构的成熟度如何 chapter 6:composing methods 组合方法 extract method 提取方法 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 在对象之间移动特性 *move method 移动方法 move field 移动字段 extract class 提取类 inline class 内联类 hide delegate 隐藏委托类 remove middle man 去除中间人 introduce foreign method 引入外加方法 *introduce local extension 引入本地扩展类 chapter 8:organizing data 组织数据 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 associationto bidirectional 将单向关联改为双向 change bidirectional association to unidirectional 将双向关联改为单向 *replace magic number with symbolic constant 用字面常量代替魔数 encapsulate field 封装字段 encapsulate collection 封装集合 replace record with data class 用数据类代替记录 *replacetype code with class 用类代替类型码 replace type code with subclasses 用子类代替类型码 replace type code with state/strategy用state/strategy 代替类型码 replace subclass with fields 用字段代替子类 chapter 9:simplifying conditional expressions 简化条件语句 decompose conditional 分解条件语句 consolidate conditional expression 合并条件语句 consolidate duplicate conditional fragments 合并重复的条件片段 remove control flag 去除控制标志 replace nested conditional with guard clauses 用守卫语句代替嵌套条件语句 replace conditional with polymorphism 用多态代替条件语句 introduce null object 引入null对象 introduce assertion 引入断言 chapter 10:making method calls simpler 简化方法调用 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 处理泛化关系 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 形成template method replace inheritance with delegation 用委托代替继承 replace delegation with inheritance 用继承代替委托 chapter 12:big refactorings(by kent beck and martin fowler) 大型重构 tease apart inheritance 分解继承层次 convert procedural design to objects 将过程式设计转换为面向对象 separate domain from presentation 将领域逻辑与表现分离 extract hierarchy 提取继承层次 chapter 13:refactoring,reuse,and reality(by william opdyke) 重构,复用与现实 a reality check 现实的检验 whv 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) 集大成 references参考文献 list of soundbites 要点列表 updates 更新内容 index 索引 |
商品评论(0条)