Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Refactoring

548 views

Published on

This slide contains a number of points should be noted that in the refactoring

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Refactoring

  1. 1. Refactoring dreampuf
  2. 2. Insight
  3. 3. Compare
  4. 4. 400 UbbParser nutshell/gksite/views_index320 Text2pic Django:core/cache/backend/memcache24016080 0 SLOC
  5. 5. 8 UbbParser nutshell/gksite/views_index Text2pic Django:core/cache/backend/memcache6420 maxBlockDepth
  6. 6. 300 UbbParser nutshell/gksite/views_index240 Text2pic Django:core/cache/backend/memcache18012060 0 numBlocks
  7. 7. 50 UbbParser nutshell/gksite/views_index40 Text2pic Django:core/cache/backend/memcache3020100 DocString(%)
  8. 8. 一种修改,使软件的内部结构更容易理解,在不改变软件的可见行为方式前提下使软件更容易变更…它是一种有节制的整理代码、使bug产生几率最小化的方法。 - Martin Fowler & Kent Beck
  9. 9. 设计原则
  10. 10. 设计原则OCP open-closed principleSRP single responsibility principleISP interface segregation principleLSP Liskov substitution principleDIP dependency inversion principle
  11. 11. 坏味道
  12. 12. 坏味道重复过长函数过长的参数列表散弹式修改耦合为未来着想太多低内聚
  13. 13. 测试
  14. 14. 测试测试自动化频繁运行保值为每一个Bug创建一个UT集中火力对付边界条件UT是昂贵的成本为测试而设计
  15. 15. 技巧
  16. 16. 技巧小步重构同时只做一项重构有TODO listUT
  17. 17. 20%其他80%
  18. 18. 文档化好样式,简单代码有意义的名称分解为原子函数描述性类型强调重要的代码提供文件头恰当的错误处理有意义的注释
  19. 19. 沟通
  20. 20. Reference
  21. 21. Thanks!

×