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

Weitere ähnliche Inhalte

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

软件工程 第十一章
软件工程 第十一章软件工程 第十一章
软件工程 第十一章浒 刘
 
D2-ETao-show
D2-ETao-showD2-ETao-show
D2-ETao-showleneli
 
系統架構設計 Android
系統架構設計  Android系統架構設計  Android
系統架構設計 Android健裕 潘
 
20130626联动优势数据访问层DAL架构和实践5(刘胜)数据分片和分页
20130626联动优势数据访问层DAL架构和实践5(刘胜)数据分片和分页20130626联动优势数据访问层DAL架构和实践5(刘胜)数据分片和分页
20130626联动优势数据访问层DAL架构和实践5(刘胜)数据分片和分页liu sheng
 
MobileWebAppFramework_V5_design
MobileWebAppFramework_V5_designMobileWebAppFramework_V5_design
MobileWebAppFramework_V5_designJackson Tian
 
Struts+Spring+Hibernate整合教程
Struts+Spring+Hibernate整合教程Struts+Spring+Hibernate整合教程
Struts+Spring+Hibernate整合教程yiditushe
 
Struts+Spring+Hibernate整合教程
Struts+Spring+Hibernate整合教程Struts+Spring+Hibernate整合教程
Struts+Spring+Hibernate整合教程appollo0312
 
数据访问层开发实践
数据访问层开发实践数据访问层开发实践
数据访问层开发实践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 cndrewz 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
 
新浪微博大规模基于Docker的混合云应用实践 -王关胜
新浪微博大规模基于Docker的混合云应用实践 -王关胜新浪微博大规模基于Docker的混合云应用实践 -王关胜
新浪微博大规模基于Docker的混合云应用实践 -王关胜Weibo Corporation
 

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

软件工程 第十一章
软件工程 第十一章软件工程 第十一章
软件工程 第十一章
 
Refactoring
RefactoringRefactoring
Refactoring
 
D2-ETao-show
D2-ETao-showD2-ETao-show
D2-ETao-show
 
Refactoring 重构
Refactoring 重构Refactoring 重构
Refactoring 重构
 
系統架構設計 Android
系統架構設計  Android系統架構設計  Android
系統架構設計 Android
 
20130626联动优势数据访问层DAL架构和实践5(刘胜)数据分片和分页
20130626联动优势数据访问层DAL架构和实践5(刘胜)数据分片和分页20130626联动优势数据访问层DAL架构和实践5(刘胜)数据分片和分页
20130626联动优势数据访问层DAL架构和实践5(刘胜)数据分片和分页
 
MobileWebAppFramework_V5_design
MobileWebAppFramework_V5_designMobileWebAppFramework_V5_design
MobileWebAppFramework_V5_design
 
Struts+Spring+Hibernate整合教程
Struts+Spring+Hibernate整合教程Struts+Spring+Hibernate整合教程
Struts+Spring+Hibernate整合教程
 
Struts+Spring+Hibernate整合教程
Struts+Spring+Hibernate整合教程Struts+Spring+Hibernate整合教程
Struts+Spring+Hibernate整合教程
 
数据访问层开发实践
数据访问层开发实践数据访问层开发实践
数据访问层开发实践
 
软件设计原则、模式与应用
软件设计原则、模式与应用软件设计原则、模式与应用
软件设计原则、模式与应用
 
imobile-beta技术沙龙
imobile-beta技术沙龙imobile-beta技术沙龙
imobile-beta技术沙龙
 
手机之家新系统介绍及架构分享
手机之家新系统介绍及架构分享手机之家新系统介绍及架构分享
手机之家新系统介绍及架构分享
 
OPOA in Action -- 使用MagixJS简化WebAPP开发
OPOA in Action -- 使用MagixJS简化WebAPP开发OPOA in Action -- 使用MagixJS简化WebAPP开发
OPOA in Action -- 使用MagixJS简化WebAPP开发
 
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 (新功能與開發介紹) 第一天
 
hibernate
hibernatehibernate
hibernate
 
Great architect cn
Great architect cnGreat architect cn
Great architect cn
 
20120613联动优势数据访问层DAL架构和实践4(刘胜)最新特性
20120613联动优势数据访问层DAL架构和实践4(刘胜)最新特性20120613联动优势数据访问层DAL架构和实践4(刘胜)最新特性
20120613联动优势数据访问层DAL架构和实践4(刘胜)最新特性
 
Taobao数据库这5年
Taobao数据库这5年Taobao数据库这5年
Taobao数据库这5年
 
新浪微博大规模基于Docker的混合云应用实践 -王关胜
新浪微博大规模基于Docker的混合云应用实践 -王关胜新浪微博大规模基于Docker的混合云应用实践 -王关胜
新浪微博大规模基于Docker的混合云应用实践 -王关胜
 

Mehr von 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 learningChris Huang
 
Kks sre book_ch10
Kks sre book_ch10Kks sre book_ch10
Kks sre book_ch10Chris Huang
 
Kks sre book_ch1,2
Kks sre book_ch1,2Kks sre book_ch1,2
Kks sre book_ch1,2Chris 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 ecosystemChris 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 tuorialChris Huang
 
Scaling big-data-mining-infra2
Scaling big-data-mining-infra2Scaling big-data-mining-infra2
Scaling big-data-mining-infra2Chris 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 2012Chris 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 2012Chris 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 SystemsChris Huang
 
Hw5 my house in yong he
Hw5 my house in yong heHw5 my house in yong he
Hw5 my house in yong heChris Huang
 
Social English Class HW4
Social English Class HW4Social English Class HW4
Social English Class HW4Chris Huang
 
Social English Class HW3
Social English Class HW3Social English Class HW3
Social English Class HW3Chris Huang
 
火柴人的故事
火柴人的故事火柴人的故事
火柴人的故事Chris Huang
 
中德文化比較
中德文化比較中德文化比較
中德文化比較Chris Huang
 

Mehr von 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
 
Kks sre book_ch10
Kks sre book_ch10Kks sre book_ch10
Kks sre book_ch10
 
Kks sre book_ch1,2
Kks sre book_ch1,2Kks sre book_ch1,2
Kks sre book_ch1,2
 
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
 
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...
 
20130310 solr tuorial
20130310 solr tuorial20130310 solr tuorial
20130310 solr tuorial
 
Scaling big-data-mining-infra2
Scaling big-data-mining-infra2Scaling big-data-mining-infra2
Scaling big-data-mining-infra2
 
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...
 
Wissbi osdc pdf
Wissbi osdc pdfWissbi osdc pdf
Wissbi osdc pdf
 
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
 
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
 
重構—改善既有程式的設計(chapter 10)
重構—改善既有程式的設計(chapter 10)重構—改善既有程式的設計(chapter 10)
重構—改善既有程式的設計(chapter 10)
 
重構—改善既有程式的設計(chapter 1)
重構—改善既有程式的設計(chapter 1)重構—改善既有程式的設計(chapter 1)
重構—改善既有程式的設計(chapter 1)
 
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
 
Hw5 my house in yong he
Hw5 my house in yong heHw5 my house in yong he
Hw5 my house in yong he
 
Social English Class HW4
Social English Class HW4Social English Class HW4
Social English Class HW4
 
Social English Class HW3
Social English Class HW3Social English Class HW3
Social English Class HW3
 
Sm Case1 Ikea
Sm Case1 IkeaSm Case1 Ikea
Sm Case1 Ikea
 
火柴人的故事
火柴人的故事火柴人的故事
火柴人的故事
 
中德文化比較
中德文化比較中德文化比較
中德文化比較
 

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