Refactoring -- Improving the Design of Existing Code


重构名录:
         第一部分:代码的坏味道(Bad smells in Code)
                   BS1: Duplicated Code(重复的代码)
BS2:Long Method(过长的函数)
                   BS3:Large Class(过大类)
                   BS4: Long Parameter List(过长参数列)
                   BS5:Divergent Change (发散式变化)
                   BS6:Shotgun Surgery (散弹式修改)
                   BS7: Feature Envy (依恋情节)
                   BS8: Data Clumps(数据泥团)
                   BS9: Primitive Obsession(基本型别偏执)
                   BS10: Switch Statements(Switch 惊悚现身)
                   BS11: Parallel Inheritance Hierarchies(平行继承体系)
                   BS12: Lazy Class(冗赘类)
                   BS13: Speculative Generality(夸夸其谈未来性)
                   BS14: Temporary Field(令人迷惑的暂时值域)
                   BS15: Message Chains(过度耦合的消息链)
                   BS16: Middle Man(中间转手人)
                   BS17: Inappropriate Intimacy(狎昵关系)
                   BS18: Alternative Classes with Different Interface
                   BS19: Incomplete Library Class(不完美的程序库类)
                   BS20: Data Class(纯数据类)
                   BS21: Refused Bequest(被拒绝的遗赠)
                   BS22: Comments(过多的注释)

         第二部分:重新组织你的函数
1.    Extract Method(提炼函数)
2.    Inline Methods(将函数内联化)
3.    Inline Temp(将临时变量内联化)
4.    Replace Temp with Query
5.    Introduce Explaining Variable
6.    Split Temporary Variable
7.    Remove Assignments to Parameters
8.    Replace Method with Method Object
9.    Substitute Algorithm


第三部分:在对象之间搬移特性
10.    Move Method
11.    Move Field
12.    Extract Class
13.    Inline Class
14.    Hide Delegate
15.    Remove Middle Man
16.    Introduce Foreign Method
17.    Introduce Local Extension
第四部分: 重新组织数据
18.    Self Encapsulate Field (自封装值域)
19.    Replace Data Value with Object(以对象取代数据)
20.    Change Value to Reference(将实值对象改为引用对象)
21.    Change Reference To Value(将引用对象改为实值对象)
22.    Replace Array With Object(以对象取代数组)
23.    Duplicate Observed Data(复制被监视数据)

第五部分:简化条件表达式
24.    Decompose Conditional(分解条件式)
25. Consolidate Conditional Expression(合并条件式)
26. Consolidate Duplicate Conditional Fragments(合并重复条件片段)
27. Remove Control Flag
28. Replace Nested Conditional with Guard(以卫语句取代嵌套条件式)
29. Replace Condition with polymorphism(以多态取代条件式)
30. Introduce Null Object (引入null对象)
31. Introduce Assertion (引入断言)

第六部分:简化函数调用
32. Rename Method
33. Add Parameter
34. Remove Parameter
35. Separate Query from Modifier
36. Parameterize Method
37. Replace Parameter with Explicit Methods
38. Preserve Whole Object
39. Replace Parameter with Methods
40. Introduce Parameter Object
41. Remove Setting Method
42. Hide Method
43. Replace Constructor with Factory Method
44. Encapsulate Downcast
45. Replace Error Code with Exception
46. Replace Exception with Test

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Your class library works, but could it be better? Refactoring: Improving the Design of Existing Code shows how refactoring can make object-oriented code simpler and easier to maintain. Today refactoring requires considerable design know-how, but once tools become available, all programmers should be able to improve their code using refactoring techniques. Besides an introduction to refactoring, this handbook provides a catalog of dozens of tips for improving code. The best thing about Refactoring is its remarkably clear presentation, along with excellent nuts-and-bolts advice, from object expert Martin Fowler. The author is also an authority on software patterns and UML, and this experience helps make this a better book, one that should be immediately accessible to any intermediate or advanced object-oriented developer. (Just like patterns, each refactoring tip is presented with a simple name, a "motivation," and examples using Java and UML.) Early chapters stress the importance of testing in successful refactoring. (When you improve code, you have to test to verify that it still works.) After the discussion on how to detect the "smell" of bad code, readers get to the heart of the book, its catalog of over 70 "refactorings"--tips for better and simpler class design. Each tip is illustrated with "before" and "after" code, along with an explanation. Later chapters provide a quick look at refactoring research. Like software patterns, refactoring may be an idea whose time has come. This groundbreaking title will surely help bring refactoring to the programming mainstream. With its clear advice on a hot new topic, Refactoring is sure to be essential reading for anyone who writes or maintains object-oriented software. --Richard Dragan Topics Covered: Refactoring, improving software code, redesign, design tips, patterns, unit testing, refactoring research, and tools.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值