代码重构的方法

  1. Add Parameter
  2. Change Bidirectional Association to Undirectional
  3. Change Reference to Value
  4. Change Undirectional Association to Bidirectional
  5. Change Value to Reference
  6. Collapse Hierarchy
  7. Consolidate Conditional Expression
  8. Consolidate Duplicate Conditional Fragments
  9. Convert Procedural Design to Objects
  10. Decompose Conditional
  11. Duplicate Observed Data
  12. Encapsulate Collection
  13. Encapsulate Downcast
  14. Encapsulate Field
  15. Extract Class
  16. Extract Hierarchy
  17. Extract Interface
  18. Extract Method
  19. Extract Subclass
  20. Extract Superclass
  21. Form Template Method
  22. Hide Delegate
  23. Hide Method
  24. Inline Class
  25. Inline Method
  26. Inline Temp
  27. Introduce Assertion
  28. Introduce Explaining Variable
  29. Introduce Foreign Method
  30. Introduce Local Extension
  31. Introduce Null Object
  32. Introduce Parameter Object
  33. Move Field
  34. Move Method
  35. Parameterize Method
  36. Preserve Whole Object
  37. Pull Up Constructor Body
  38. Pull Up Field
  39. Pull Up Method
  40. Push Down Field
  41. Push Down Method
  42. Remove Assignments to Parameters
  43. Remove Control Flag
  44. Remove Middle Man
  45. Remove Setting Method
  46. Rename Method
  47. Replace Array with Object
  48. Replace Conditional with Polymorphism
  49. Replace Constructor with Factory Method
  50. Replace Data Value with Object
  51. Replace Delegation with Inheritance
  52. Replace Error Code with Exception
  53. Replace Exception with Test
  54. Replace Inheritance with Delegation
  55. Replace Magic Number with Symbolic Constant
  56. Replace Method with Method Object
  57. Replace Nested Conditional with Guard Clauses
  58. Replace Parameter with Explicit Methods
  59. Replace Parameter with Methods
  60. Replace Record with Data Class
  61. Replace Subclass with Fields
  62. Replace Temp with Query
  63. Replace Type Code with Class
  64. Replace Type Code with State/Strategy
  65. Replace Type Code with Subclasses
  66. Self Encapsulate Field
  67. Separate Domain from Presentation
  68. Separate Query from Modifier
  69. Split Temporary Variable
  70. Substitute Algorithm
  71. Tease Apart Inheritance

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

发表于

我来说两句

0 条评论
登录 后参与评论

相关文章

来自专栏码匠的流水账

聊聊flink的RichParallelSourceFunction

flink-streaming-java_2.11-1.6.2-sources.jar!/org/apache/flink/streaming/api/func...

1751
来自专栏码匠的流水账

聊聊storm worker的executor与task

storm-2.0.0/storm-client/src/jvm/org/apache/storm/daemon/worker/Worker.java

912
来自专栏码匠的流水账

聊聊storm的maxSpoutPending

storm-2.0.0/storm-client/src/jvm/org/apache/storm/Config.java

1855
来自专栏程序员宝库

Java 8 时间 API 快速入门

Java 8 出来很久了,各位也可能已经在用了,不过其中新的时间日期 API 可能很少人用,甚至不知道怎么上手。本文快速介绍一下其中的主要的类的概念和用法。 一...

2965
来自专栏老马说编程

(33) Joda-Time / 计算机程序的思维逻辑

Joda-Time 上节介绍了JDK API中的日期和时间类,我们提到了JDK API的一些不足,并提到,实践中有一个广泛使用的日期和时间类库,Joda-Tim...

1988
来自专栏码匠的流水账

聊聊storm的ICommitterTridentSpout

storm-core-1.2.2-sources.jar!/org/apache/storm/trident/spout/ICommitterTridentSp...

1043
来自专栏函数式编程语言及工具

Akka(23): Stream:自定义流构件功能-Custom defined stream processing stages

    从总体上看:akka-stream是由数据源头Source,流通节点Flow和数据流终点Sink三个框架性的流构件(stream components)...

4258
来自专栏积累沉淀

研究MapReduce源码之实现自定义LineRecordReader完成多行读取文件内容

TextInputFormat是Hadoop默认的数据输入格式,但是它只能一行一行的读记录,如果要读取多行怎么办? 很简单 自己写一个输入格式,然后写一个对...

1989
来自专栏个人分享

Spark RDD类源码阅读

1021
来自专栏码匠的流水账

聊聊storm的LoggingMetricsConsumer

storm-2.0.0/storm-client/src/jvm/org/apache/storm/metric/LoggingMetricsConsumer....

1033

扫码关注云+社区