SlideShare a Scribd company logo
May.  2011 Jerry HsuRefactoring (ch 12, 13)
2ClassificationChapter 12. Big Refactorings本質沒有準確的重構步驟時間
3ClassificationChapter 12. Big Refactorings梳理並分解繼承體系將程序式設計轉化為物件設計將領域和表述/顯示分離提煉繼承體系
4Classification12.1 Tease Apart Inheritance梳理並分解繼承體系混亂的繼承體系重複的程式碼某個繼承體系承擔了兩項不同的責任交易種類顯示風格
5ClassificationTease Apart Inheritance1. Extract class
6Classification12.1 Tease Apart Inheritance2. Create sub class3. Move method
7Classification12.1 Tease Apart Inheritance
8Classification12.1 Tease Apart Inheritance
9Classification12.2 Convert Procedural Design to Objects將程序式設計轉化為物件設計
10Classification12.2 Convert Procedural Design to Objects作法: 看課本Ex: Page 5  Page 51
11Classification12.3 Separate Domain from Presentation 將領域和表述/顯示分離
12Classification12.3 Separate Domain from Presentation MVCModel	 DomainView	 PresentationControl	 Logicone business logic  multiple views
13Classification12.3 Separate Domain from Presentation InvokerTable entityBusiness entityTransformDatabase
14Classification12.4 Extract Hierarchy 提煉繼承體系某個class做了太多工作,其中一部分的工作是以大量條件式完成的
15Classification12.4 Extract Hierarchy
16ClassificationChapter 13. Refactroing, Reuse and Reality為什麼開發者不願意重構他們的程式你不知道如何重構重構的效益要長時間才能展現出來重構是一項額外工作,老闆付錢給你是要你寫新功能重構會破壞現有程式
17ClassificationChapter 13. Refactroing, Reuse and Reality重構的效益要長時間才能展現出來短期利益程式碼總量變少重複的程式碼有錯誤只需要修改一個地方Trace, debug中期利益重構的抽象層對於定義後續檔案系統很有幫助長期利益我們的身體健康
18ClassificationChapter 13. Refactroing, Reuse and Reality降低重構帶來的額外開銷
Reduce the overhead of refactoring工具雖然重構需要額外開銷,但是可以從”在程式開發期間其他階段降低所需心力及滯怠時間”而獲得補償
19ClassificationChapter 13. Refactroing, Reuse and Reality安全的進行重構How相信自己的功力相信compiler相信test suite相信 code review
Ad

More Related Content

Similar to 重構—改善既有程式的設計(chapter 12,13) (20)

软件工程 第十一章
软件工程 第十一章软件工程 第十一章
软件工程 第十一章
浒 刘
 
D2-ETao-show
D2-ETao-showD2-ETao-show
D2-ETao-show
leneli
 
Refactoring 重构
Refactoring 重构Refactoring 重构
Refactoring 重构
liufabin 66688
 
系統架構設計 Android
系統架構設計  Android系統架構設計  Android
系統架構設計 Android
健裕 潘
 
20130626联动优势数据访问层DAL架构和实践5(刘胜)数据分片和分页
20130626联动优势数据访问层DAL架构和实践5(刘胜)数据分片和分页20130626联动优势数据访问层DAL架构和实践5(刘胜)数据分片和分页
20130626联动优势数据访问层DAL架构和实践5(刘胜)数据分片和分页
liu sheng
 
重构:改善既有代码的设计(第2版)(异步图书) (马丁_ (Z-Library).pdf
重构:改善既有代码的设计(第2版)(异步图书) (马丁_ (Z-Library).pdf重构:改善既有代码的设计(第2版)(异步图书) (马丁_ (Z-Library).pdf
重构:改善既有代码的设计(第2版)(异步图书) (马丁_ (Z-Library).pdf
leqazwsxedc
 
MobileWebAppFramework_V5_design
MobileWebAppFramework_V5_designMobileWebAppFramework_V5_design
MobileWebAppFramework_V5_design
Jackson Tian
 
Struts+Spring+Hibernate整合教程
Struts+Spring+Hibernate整合教程Struts+Spring+Hibernate整合教程
Struts+Spring+Hibernate整合教程
appollo0312
 
Struts+Spring+Hibernate整合教程
Struts+Spring+Hibernate整合教程Struts+Spring+Hibernate整合教程
Struts+Spring+Hibernate整合教程
yiditushe
 
数据访问层开发实践
数据访问层开发实践数据访问层开发实践
数据访问层开发实践
xcq
 
软件设计原则、模式与应用
软件设计原则、模式与应用软件设计原则、模式与应用
软件设计原则、模式与应用
yiditushe
 
imobile-beta技术沙龙
imobile-beta技术沙龙imobile-beta技术沙龙
imobile-beta技术沙龙
posestudio
 
手机之家新系统介绍及架构分享
手机之家新系统介绍及架构分享手机之家新系统介绍及架构分享
手机之家新系统介绍及架构分享
Dahui Feng
 
OPOA in Action -- 使用MagixJS简化WebAPP开发
OPOA in Action -- 使用MagixJS简化WebAPP开发OPOA in Action -- 使用MagixJS简化WebAPP开发
OPOA in Action -- 使用MagixJS简化WebAPP开发
leneli
 
Visual studio 2012 與 asp.net 4.5 (新功能與開發介紹) 第一天
Visual studio 2012 與 asp.net 4.5 (新功能與開發介紹) 第一天Visual studio 2012 與 asp.net 4.5 (新功能與開發介紹) 第一天
Visual studio 2012 與 asp.net 4.5 (新功能與開發介紹) 第一天
Gelis Wu
 
Great architect cn
Great architect cnGreat architect cn
Great architect cn
drewz lin
 
20120613联动优势数据访问层DAL架构和实践4(刘胜)最新特性
20120613联动优势数据访问层DAL架构和实践4(刘胜)最新特性20120613联动优势数据访问层DAL架构和实践4(刘胜)最新特性
20120613联动优势数据访问层DAL架构和实践4(刘胜)最新特性
liu sheng
 
Taobao数据库这5年
Taobao数据库这5年Taobao数据库这5年
Taobao数据库这5年
yp_fangdong
 
软件工程 第十一章
软件工程 第十一章软件工程 第十一章
软件工程 第十一章
浒 刘
 
D2-ETao-show
D2-ETao-showD2-ETao-show
D2-ETao-show
leneli
 
系統架構設計 Android
系統架構設計  Android系統架構設計  Android
系統架構設計 Android
健裕 潘
 
20130626联动优势数据访问层DAL架构和实践5(刘胜)数据分片和分页
20130626联动优势数据访问层DAL架构和实践5(刘胜)数据分片和分页20130626联动优势数据访问层DAL架构和实践5(刘胜)数据分片和分页
20130626联动优势数据访问层DAL架构和实践5(刘胜)数据分片和分页
liu sheng
 
重构:改善既有代码的设计(第2版)(异步图书) (马丁_ (Z-Library).pdf
重构:改善既有代码的设计(第2版)(异步图书) (马丁_ (Z-Library).pdf重构:改善既有代码的设计(第2版)(异步图书) (马丁_ (Z-Library).pdf
重构:改善既有代码的设计(第2版)(异步图书) (马丁_ (Z-Library).pdf
leqazwsxedc
 
MobileWebAppFramework_V5_design
MobileWebAppFramework_V5_designMobileWebAppFramework_V5_design
MobileWebAppFramework_V5_design
Jackson Tian
 
Struts+Spring+Hibernate整合教程
Struts+Spring+Hibernate整合教程Struts+Spring+Hibernate整合教程
Struts+Spring+Hibernate整合教程
appollo0312
 
Struts+Spring+Hibernate整合教程
Struts+Spring+Hibernate整合教程Struts+Spring+Hibernate整合教程
Struts+Spring+Hibernate整合教程
yiditushe
 
数据访问层开发实践
数据访问层开发实践数据访问层开发实践
数据访问层开发实践
xcq
 
软件设计原则、模式与应用
软件设计原则、模式与应用软件设计原则、模式与应用
软件设计原则、模式与应用
yiditushe
 
imobile-beta技术沙龙
imobile-beta技术沙龙imobile-beta技术沙龙
imobile-beta技术沙龙
posestudio
 
手机之家新系统介绍及架构分享
手机之家新系统介绍及架构分享手机之家新系统介绍及架构分享
手机之家新系统介绍及架构分享
Dahui Feng
 
OPOA in Action -- 使用MagixJS简化WebAPP开发
OPOA in Action -- 使用MagixJS简化WebAPP开发OPOA in Action -- 使用MagixJS简化WebAPP开发
OPOA in Action -- 使用MagixJS简化WebAPP开发
leneli
 
Visual studio 2012 與 asp.net 4.5 (新功能與開發介紹) 第一天
Visual studio 2012 與 asp.net 4.5 (新功能與開發介紹) 第一天Visual studio 2012 與 asp.net 4.5 (新功能與開發介紹) 第一天
Visual studio 2012 與 asp.net 4.5 (新功能與開發介紹) 第一天
Gelis Wu
 
Great architect cn
Great architect cnGreat architect cn
Great architect cn
drewz lin
 
20120613联动优势数据访问层DAL架构和实践4(刘胜)最新特性
20120613联动优势数据访问层DAL架构和实践4(刘胜)最新特性20120613联动优势数据访问层DAL架构和实践4(刘胜)最新特性
20120613联动优势数据访问层DAL架构和实践4(刘胜)最新特性
liu sheng
 
Taobao数据库这5年
Taobao数据库这5年Taobao数据库这5年
Taobao数据库这5年
yp_fangdong
 

More from Chris Huang (20)

Data compression, data security, and machine learning
Data compression, data security, and machine learningData compression, data security, and machine learning
Data compression, data security, and machine learning
Chris Huang
 
Kks sre book_ch10
Kks sre book_ch10Kks sre book_ch10
Kks sre book_ch10
Chris Huang
 
Kks sre book_ch1,2
Kks sre book_ch1,2Kks sre book_ch1,2
Kks sre book_ch1,2
Chris Huang
 
Real time big data applications with hadoop ecosystem
Real time big data applications with hadoop ecosystemReal time big data applications with hadoop ecosystem
Real time big data applications with hadoop ecosystem
Chris Huang
 
A Graph Service for Global Web Entities Traversal and Reputation Evaluation B...
A Graph Service for Global Web Entities Traversal and Reputation Evaluation B...A Graph Service for Global Web Entities Traversal and Reputation Evaluation B...
A Graph Service for Global Web Entities Traversal and Reputation Evaluation B...
Chris Huang
 
20130310 solr tuorial
20130310 solr tuorial20130310 solr tuorial
20130310 solr tuorial
Chris Huang
 
Scaling big-data-mining-infra2
Scaling big-data-mining-infra2Scaling big-data-mining-infra2
Scaling big-data-mining-infra2
Chris Huang
 
Applying Media Content Analysis to the Production of Musical Videos as Summar...
Applying Media Content Analysis to the Production of Musical Videos as Summar...Applying Media Content Analysis to the Production of Musical Videos as Summar...
Applying Media Content Analysis to the Production of Musical Videos as Summar...
Chris Huang
 
Wissbi osdc pdf
Wissbi osdc pdfWissbi osdc pdf
Wissbi osdc pdf
Chris Huang
 
Hbase status quo apache-con europe - nov 2012
Hbase status quo   apache-con europe - nov 2012Hbase status quo   apache-con europe - nov 2012
Hbase status quo apache-con europe - nov 2012
Chris Huang
 
Hbase schema design and sizing apache-con europe - nov 2012
Hbase schema design and sizing   apache-con europe - nov 2012Hbase schema design and sizing   apache-con europe - nov 2012
Hbase schema design and sizing apache-con europe - nov 2012
Chris Huang
 
重構—改善既有程式的設計(chapter 10)
重構—改善既有程式的設計(chapter 10)重構—改善既有程式的設計(chapter 10)
重構—改善既有程式的設計(chapter 10)
Chris Huang
 
重構—改善既有程式的設計(chapter 1)
重構—改善既有程式的設計(chapter 1)重構—改善既有程式的設計(chapter 1)
重構—改善既有程式的設計(chapter 1)
Chris Huang
 
Designs, Lessons and Advice from Building Large Distributed Systems
Designs, Lessons and Advice from Building Large Distributed SystemsDesigns, Lessons and Advice from Building Large Distributed Systems
Designs, Lessons and Advice from Building Large Distributed Systems
Chris Huang
 
Hw5 my house in yong he
Hw5 my house in yong heHw5 my house in yong he
Hw5 my house in yong he
Chris Huang
 
Social English Class HW4
Social English Class HW4Social English Class HW4
Social English Class HW4
Chris Huang
 
Social English Class HW3
Social English Class HW3Social English Class HW3
Social English Class HW3
Chris Huang
 
Sm Case1 Ikea
Sm Case1 IkeaSm Case1 Ikea
Sm Case1 Ikea
Chris Huang
 
火柴人的故事
火柴人的故事火柴人的故事
火柴人的故事
Chris Huang
 
中德文化比較
中德文化比較中德文化比較
中德文化比較
Chris Huang
 
Data compression, data security, and machine learning
Data compression, data security, and machine learningData compression, data security, and machine learning
Data compression, data security, and machine learning
Chris Huang
 
Kks sre book_ch10
Kks sre book_ch10Kks sre book_ch10
Kks sre book_ch10
Chris Huang
 
Kks sre book_ch1,2
Kks sre book_ch1,2Kks sre book_ch1,2
Kks sre book_ch1,2
Chris Huang
 
Real time big data applications with hadoop ecosystem
Real time big data applications with hadoop ecosystemReal time big data applications with hadoop ecosystem
Real time big data applications with hadoop ecosystem
Chris Huang
 
A Graph Service for Global Web Entities Traversal and Reputation Evaluation B...
A Graph Service for Global Web Entities Traversal and Reputation Evaluation B...A Graph Service for Global Web Entities Traversal and Reputation Evaluation B...
A Graph Service for Global Web Entities Traversal and Reputation Evaluation B...
Chris Huang
 
20130310 solr tuorial
20130310 solr tuorial20130310 solr tuorial
20130310 solr tuorial
Chris Huang
 
Scaling big-data-mining-infra2
Scaling big-data-mining-infra2Scaling big-data-mining-infra2
Scaling big-data-mining-infra2
Chris Huang
 
Applying Media Content Analysis to the Production of Musical Videos as Summar...
Applying Media Content Analysis to the Production of Musical Videos as Summar...Applying Media Content Analysis to the Production of Musical Videos as Summar...
Applying Media Content Analysis to the Production of Musical Videos as Summar...
Chris Huang
 
Hbase status quo apache-con europe - nov 2012
Hbase status quo   apache-con europe - nov 2012Hbase status quo   apache-con europe - nov 2012
Hbase status quo apache-con europe - nov 2012
Chris Huang
 
Hbase schema design and sizing apache-con europe - nov 2012
Hbase schema design and sizing   apache-con europe - nov 2012Hbase schema design and sizing   apache-con europe - nov 2012
Hbase schema design and sizing apache-con europe - nov 2012
Chris Huang
 
重構—改善既有程式的設計(chapter 10)
重構—改善既有程式的設計(chapter 10)重構—改善既有程式的設計(chapter 10)
重構—改善既有程式的設計(chapter 10)
Chris Huang
 
重構—改善既有程式的設計(chapter 1)
重構—改善既有程式的設計(chapter 1)重構—改善既有程式的設計(chapter 1)
重構—改善既有程式的設計(chapter 1)
Chris Huang
 
Designs, Lessons and Advice from Building Large Distributed Systems
Designs, Lessons and Advice from Building Large Distributed SystemsDesigns, Lessons and Advice from Building Large Distributed Systems
Designs, Lessons and Advice from Building Large Distributed Systems
Chris Huang
 
Hw5 my house in yong he
Hw5 my house in yong heHw5 my house in yong he
Hw5 my house in yong he
Chris Huang
 
Social English Class HW4
Social English Class HW4Social English Class HW4
Social English Class HW4
Chris Huang
 
Social English Class HW3
Social English Class HW3Social English Class HW3
Social English Class HW3
Chris Huang
 
火柴人的故事
火柴人的故事火柴人的故事
火柴人的故事
Chris Huang
 
中德文化比較
中德文化比較中德文化比較
中德文化比較
Chris Huang
 
Ad

重構—改善既有程式的設計(chapter 12,13)