Make changes on existing code for subsequent and constant changes of requirement.

Reference:http://www.refactoring.com/catalog/index.html

Ways of Refactorings

Summerize:
    Techniques that allow for more abstraction

  • Encapsulate Field – force code to access the field with getter and setter methods
  • Generalize Type – create more general types to allow for more code sharing
  • Replace type-checking code with State/Strategy[6]
  • Replace conditional with polymorphism [7]

Techniques for breaking code apart into more logical pieces

  • Componentization breaks code down into reusable semantic units which present clear, well-defined, simple-to-use interfaces.
  • Extract Class moves part of the code from an existing class into a new class.
  • Extract Method, to turn part of a larger method into a new method. By breaking down code in smaller pieces, it is more easily understandable. This is also applicable to functions.

Techniques for improving names and location of code

  • Move Method or Move Field – move to a more appropriate Class or source file
  • Rename Method or Rename Field – changing the name into a new one that better reveals its purpose
  • Pull Up – in OOP, move to a superclass
  • Push Down – in OOP, move to a subclass

最新文章

  1. C语言 百炼成钢13
  2. ci文件缓存使用,可以用来实现多模板切换 改写URL辅助函数
  3. Windows通过DOS命令进入MYSQL的方法
  4. Learning Puppet — Resources and the RAL
  5. IOS学习之路-- 指针&宏函数
  6. Spring各种注解标签作用详解
  7. 如何在COM的IDL文件中include头文件?
  8. traits编程技法
  9. 【翻译】在Mac上使用VSCode创建你的第一个Asp.Net Core应用
  10. kindeditor集成ckplayer(带右键编辑菜单)
  11. DS标签控件文本解析格式
  12. QString与LPWSTR之间的转换;
  13. [Swift]LeetCode846. 一手顺子 | Hand of Straights
  14. Emmet 简介
  15. github 快速部署
  16. escu问题及解决
  17. 深度学习中 droupout层是咋回事??
  18. js 复制对象的深复制与浅复制
  19. python文件相关
  20. Eclipse下安装SVN插件以及连接SVN服务并发布项目

热门文章

  1. 微信网页授权操作逻辑封装-C#实例
  2. maven 发布 到 远程 tomcat
  3. Applese 涂颜色(欧拉降幂)
  4. hdu6397 Character Encoding 隔板法+容斥原理+线性逆元方程
  5. poj1062 昂贵的礼物(dijkstra+枚举)
  6. xpath的基础使用
  7. day_07 深浅拷贝
  8. 安装openstack时遇到的错误
  9. mysql 示例数据库安装
  10. 29-----BBS论坛