代码重构的方法

  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 条评论
登录 后参与评论

相关文章

来自专栏智能大石头

C++返回值优化RVO

返回值优化,是一种属于编译器的技术,它通过转换源代码和对象的创建来加快源代码的执行速度。RVO = return value optimization。 测试...

2379
来自专栏Netkiller

Struts Ajax Json

Netkiller Java 手札 Java, Servlet, JavaBean ... 5.4. Ajax + JSON struts.xml 中加入 ...

2543
来自专栏码匠的流水账

kafka0.8生产者异常处理

本文简单解析一下kafka0.8.2.2版本中的java producer的异常处理。

711
来自专栏码匠的流水账

聊聊storm的JoinBolt

storm-2.0.0/storm-client/src/jvm/org/apache/storm/bolt/JoinBolt.java

1214
来自专栏码匠的流水账

聊聊flink的RichParallelSourceFunction

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

941
来自专栏码匠的流水账

聊聊storm的ICommitterTridentSpout

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

652
来自专栏程序员宝库

Java 8 时间 API 快速入门

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

2795
来自专栏码匠的流水账

聊聊storm的LoggingMetricsConsumer

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

983
来自专栏码匠的流水账

聊聊storm的maxSpoutPending

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

1525
来自专栏菩提树下的杨过

温故而知新:设计模式之原型模式(Prototype)

原型模式个人以为最适合的场景:参照现有的某一个对象实例,快速得到多个完整的实例副本。(通常是深拷贝的副本) 深拷贝在c#中实现的最简单方式莫过于通过反序列化得到...

2265

扫码关注云+社区