书籍详情
《重构:改善既有代码的设计》[58M]百度网盘|亲测有效|pdf下载
  • 重构:改善既有代码的设计

  • 出版时间:2011-06
  • 热度:4655
  • 上架时间:2024-06-30 09:08:33
  • 价格:0.0
书籍下载
书籍预览
免责声明

本站支持尊重有效期内的版权/著作权,所有的资源均来自于互联网网友分享或网盘资源,一旦发现资源涉及侵权,将立即删除。希望所有用户一同监督并反馈问题,如有侵权请联系站长或发送邮件到ebook666@outlook.com,本站将立马改正

内容介绍

编辑推荐

  

MartinFowler和本书另几位作者清楚揭示了重构过程,他们为面向对象软件开发所做的贡献难以衡量。《重构——改善既有代码的设计(评注版)》解释了重构的原理和佳实践,并指出何时何地你应该开始挖掘你的代码以求改善。本书的核心是一系列完整的重构方法,其中每一项都介绍一种经过实践检验的代码变换手法的动机和技术。某些项目如ExtractMethod和MoveField看起来可能很浅显,但不要掉以轻心,因为理解这类技术正是有条不紊地进行重构的关键。本书所提的这些重构手法将帮助你一次一小步地修改你的代码,这就减少了过程中的风险。很快你就会把这些重构手法和其名称加入自己的开发词典中,并且朗朗上口。

内容简介

  重构,一言以蔽之,就是在不改变外部行为的前提下,有条不紊地改善代码。多年前,正是本书原版的出版,使重构终于从编程高手们的小圈子走出,成为众多普通程序员日常开发工作中不可或缺的一部分。《重构:改善既有代码的设计(评注版)》也因此成为与《设计模式》齐名的经典著作,被译为中、德、俄、日等众多语言,在世界范围内畅销不衰。
     Martin Fowler等著的《重构:改善既有代码的设计(评注版)》凝聚了软件开发社区专家多年摸索而获得的宝贵经验,拥有不因时光流逝而磨灭的价值。今天,无论是重构本身,业界对重构的理解,还是开发工具对重构的支持力度,都与本书最初出版时不可同日而语,但书中所蕴涵的意味和精华,依然值得反复咀嚼,而且往往能够常读常新。
     《重构:改善既有代码的设计(评注版)》力邀国内资深专家执笔,在英文原著基础上增加中文点评与注释,旨在以先行者的学研心得与实践感悟,对读者阅读与学习加以点拨、指明捷径。

作者简介

  Martin Fowler世界级软件开发大师,在面向对象分析设计、UML、模式、XP和重构等领域都有卓越贡献,曾任著名软件开发咨询公司ThoughtWorks的首席科学家。他的多部著作《分析模式》、《UML精悴》和《企业应用架构模式》等都已经成为脍炙人口的经典。

内页插图

目录

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(新增批注共11条)
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(新增批注共9条)
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
(新增批注共12条)
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 state/strategy
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(新增批注共14条)
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


前言/序言

  序
  “重构”这个概念来自Smalltalk圈子,没多久就进入了其他语言阵营之中。由于重构是框架开发中不可缺少的一部分,所以当框架开发人员讨论自己的工作时,这个术语就诞生了。当他们精练自己的类继承体系时,当他们叫喊自己可以拿掉多少多少行代码时,重构的概念慢慢浮出水面。框架设计者知道,这东西不可能一开始就完全正确,它将随着设计者的经验成长而进化;他们也知道,代码被阅读和被修改的次数远远多于它被编写的次数。保持代码易读、易修改的关键,就是重构——对框架而言如此,对一般软件也如此。
  好极了,还有什么问题吗?问题很显然:重构具有风险。它必须修改运作中的程序,这可能引入一些不易察觉的错误。如果重构方式不恰当,可能毁掉你数天甚至数星期的成果。如果重构时不做好准备,不遵守规则,风险就更大。你挖掘自己的代码,很快发现了一些值得修改的地方,于是你挖得更深。挖得越深,找到的重构机会就越多,于是你的修改也越多……最后你给自己挖了个大坑,却爬不出去了。为了避免自掘坟墓,重构必须系统化进行。我在《设计模式》书中和另外三位作者曾经提过:设计模式为重构提供了目标。然而“确定目标”只是问题的一部分而已,改造程序以达到目标是另一个难题。
  MartinFowler和本书另几位作者清楚揭示了重构过程,他们为面向对象软件开发所做的贡献难以衡量。本书解释了重构的原理和最佳实践,并指出何时何地你应该开始挖掘你的代码以求改善。本书的核心是一系列完整的重构方法,其中每一项都介绍一种经过实践检验的代码变换手法的动机和技术。某些项目如ExtractMethod和MoveField看起来可能很浅显,但不要掉以轻心,因为理解这类技术正是有条不紊地进行重构的关键。本书所提的这些重构手法将帮助你一次一小步地修改你的代码,这就减少了过程中的风险。很快你就会把这些重构手法和其名称加入自己的开发词典中,并且朗朗上口。
  我第一次体验有讲究的、一次一小步的重构,是某次与Kent Beck在30000英尺高空的飞行旅途中结对编程。我们运用本书收录的重构手法,保证每次只走一步。最后,我对这种实践方式的效果感到十分惊讶。我不但对最后结果更有信心,而且开发压力也小了很多。所以,我极力推荐你试试这些重构手法,你和你的程序都将因此更美好。
  Erich Gamma
  《设计模式》第一作者,Eclipse平台主架构师熊节 译
  ……