Suche senden
Hochladen
重構—改善既有程式的設計(chapter 10)
•
Als PPTX, PDF herunterladen
•
1 gefällt mir
•
719 views
Chris Huang
Folgen
Bildung
Technologie
Gesundheit & Medizin
Melden
Teilen
Melden
Teilen
1 von 60
Jetzt herunterladen
Empfohlen
重構—改善既有程式的設計(chapter 6)
重構—改善既有程式的設計(chapter 6)
Chris Huang
Notes for xml updated
Notes for xml updated
Mohamed Hassan
(Unit )-Testing for Joomla
(Unit )-Testing for Joomla
David Jardin
10 Creating Triggers
10 Creating Triggers
rehaniltifat
What is UFT? HP's unified functional testing.
What is UFT? HP's unified functional testing.
Confiz
jasmine
jasmine
Asanka Indrajith
Orcal FUNCTIONS
Orcal FUNCTIONS
ASHABOOPATHY
Report
Report
Niran Patel
Empfohlen
重構—改善既有程式的設計(chapter 6)
重構—改善既有程式的設計(chapter 6)
Chris Huang
Notes for xml updated
Notes for xml updated
Mohamed Hassan
(Unit )-Testing for Joomla
(Unit )-Testing for Joomla
David Jardin
10 Creating Triggers
10 Creating Triggers
rehaniltifat
What is UFT? HP's unified functional testing.
What is UFT? HP's unified functional testing.
Confiz
jasmine
jasmine
Asanka Indrajith
Orcal FUNCTIONS
Orcal FUNCTIONS
ASHABOOPATHY
Report
Report
Niran Patel
Spring AOP
Spring AOP
Tata Consultancy Services
ADVANCE SQL-"Sub queries"
ADVANCE SQL-"Sub queries"
Ankit Surti
An introduction to apex code test methods developer.force
An introduction to apex code test methods developer.force
sendmail2cherukuri
e computer notes - Subqueries
e computer notes - Subqueries
ecomputernotes
Spring framework part 2
Spring framework part 2
Skillwise Group
QTP&UFT Automation Framework
QTP&UFT Automation Framework
Yu Tao Zhang
Procedures/functions of rdbms
Procedures/functions of rdbms
jain.pralabh
Effective Readable unit testing with junit5
Effective Readable unit testing with junit5
Sajith Vijesekara
Function & procedure
Function & procedure
atishupadhyay
Qtp Basics
Qtp Basics
mehramit
Plsql
Plsql
Shohan Ahmed
Apex Testing and Best Practices
Apex Testing and Best Practices
Jitendra Zaa
Oracle: Procedures
Oracle: Procedures
DataminingTools Inc
Stored procedure
Stored procedure
baabtra.com - No. 1 supplier of quality freshers
Ppt Qtp
Ppt Qtp
rosaleenm
Introduction to Everit Component Registry - B Zsoldos
Introduction to Everit Component Registry - B Zsoldos
mfrancis
Keyword Driven Automation
Keyword Driven Automation
Pankaj Goel
Functions
Functions
primeteacher32
Function Parameters
Function Parameters
primeteacher32
Performance tuning
Performance tuning
ami111
pl/sql Procedure
pl/sql Procedure
Pooja Dixit
Rules. Обзор, примеры, API.
Rules. Обзор, примеры, API.
DrupalForumZP2012
Weitere ähnliche Inhalte
Was ist angesagt?
Spring AOP
Spring AOP
Tata Consultancy Services
ADVANCE SQL-"Sub queries"
ADVANCE SQL-"Sub queries"
Ankit Surti
An introduction to apex code test methods developer.force
An introduction to apex code test methods developer.force
sendmail2cherukuri
e computer notes - Subqueries
e computer notes - Subqueries
ecomputernotes
Spring framework part 2
Spring framework part 2
Skillwise Group
QTP&UFT Automation Framework
QTP&UFT Automation Framework
Yu Tao Zhang
Procedures/functions of rdbms
Procedures/functions of rdbms
jain.pralabh
Effective Readable unit testing with junit5
Effective Readable unit testing with junit5
Sajith Vijesekara
Function & procedure
Function & procedure
atishupadhyay
Qtp Basics
Qtp Basics
mehramit
Plsql
Plsql
Shohan Ahmed
Apex Testing and Best Practices
Apex Testing and Best Practices
Jitendra Zaa
Oracle: Procedures
Oracle: Procedures
DataminingTools Inc
Stored procedure
Stored procedure
baabtra.com - No. 1 supplier of quality freshers
Ppt Qtp
Ppt Qtp
rosaleenm
Introduction to Everit Component Registry - B Zsoldos
Introduction to Everit Component Registry - B Zsoldos
mfrancis
Keyword Driven Automation
Keyword Driven Automation
Pankaj Goel
Functions
Functions
primeteacher32
Function Parameters
Function Parameters
primeteacher32
Performance tuning
Performance tuning
ami111
Was ist angesagt?
(20)
Spring AOP
Spring AOP
ADVANCE SQL-"Sub queries"
ADVANCE SQL-"Sub queries"
An introduction to apex code test methods developer.force
An introduction to apex code test methods developer.force
e computer notes - Subqueries
e computer notes - Subqueries
Spring framework part 2
Spring framework part 2
QTP&UFT Automation Framework
QTP&UFT Automation Framework
Procedures/functions of rdbms
Procedures/functions of rdbms
Effective Readable unit testing with junit5
Effective Readable unit testing with junit5
Function & procedure
Function & procedure
Qtp Basics
Qtp Basics
Plsql
Plsql
Apex Testing and Best Practices
Apex Testing and Best Practices
Oracle: Procedures
Oracle: Procedures
Stored procedure
Stored procedure
Ppt Qtp
Ppt Qtp
Introduction to Everit Component Registry - B Zsoldos
Introduction to Everit Component Registry - B Zsoldos
Keyword Driven Automation
Keyword Driven Automation
Functions
Functions
Function Parameters
Function Parameters
Performance tuning
Performance tuning
Ähnlich wie 重構—改善既有程式的設計(chapter 10)
pl/sql Procedure
pl/sql Procedure
Pooja Dixit
Rules. Обзор, примеры, API.
Rules. Обзор, примеры, API.
DrupalForumZP2012
Stored procedures
Stored procedures
Muhammad Younis
05 Creating Stored Procedures
05 Creating Stored Procedures
rehaniltifat
Ch10
Ch10
phanleson
Junit4.0
Junit4.0
gouthamrv
Automation with bpt methodology
Automation with bpt methodology
Gopi Nath
object oriented system analysis and design
object oriented system analysis and design
wekineheshete
Spring framework in depth
Spring framework in depth
Vinay Kumar
Formal Specification in Software Engineering SE9
Formal Specification in Software Engineering SE9
koolkampus
Query Management system-Iv review
Query Management system-Iv review
logeshprabu
Enterprise Library 3.0 Policy Injection Applicatoin Block
Enterprise Library 3.0 Policy Injection Applicatoin Block
mcgurk
Testware Hierarchy for Test Automation
Testware Hierarchy for Test Automation
Gregory Solovey
Oracle_Procurement_Cloud_Release_8_Whats_New
Oracle_Procurement_Cloud_Release_8_Whats_New
Khalil Rehman NLP (MPrac) MCIPS, PMP,OCP
Code Refactoring - 3.0
Code Refactoring - 3.0
Arul Prakash
TDD And Refactoring
TDD And Refactoring
Naresh Jain
ASP.NET MVC controllers
ASP.NET MVC controllers
Mahmoud Tolba
Software test management overview for managers
Software test management overview for managers
TJamesLeDoux
plsql les01
plsql les01
sasa_eldoby
Ähnlich wie 重構—改善既有程式的設計(chapter 10)
(19)
pl/sql Procedure
pl/sql Procedure
Rules. Обзор, примеры, API.
Rules. Обзор, примеры, API.
Stored procedures
Stored procedures
05 Creating Stored Procedures
05 Creating Stored Procedures
Ch10
Ch10
Junit4.0
Junit4.0
Automation with bpt methodology
Automation with bpt methodology
object oriented system analysis and design
object oriented system analysis and design
Spring framework in depth
Spring framework in depth
Formal Specification in Software Engineering SE9
Formal Specification in Software Engineering SE9
Query Management system-Iv review
Query Management system-Iv review
Enterprise Library 3.0 Policy Injection Applicatoin Block
Enterprise Library 3.0 Policy Injection Applicatoin Block
Testware Hierarchy for Test Automation
Testware Hierarchy for Test Automation
Oracle_Procurement_Cloud_Release_8_Whats_New
Oracle_Procurement_Cloud_Release_8_Whats_New
Code Refactoring - 3.0
Code Refactoring - 3.0
TDD And Refactoring
TDD And Refactoring
ASP.NET MVC controllers
ASP.NET MVC controllers
Software test management overview for managers
Software test management overview for managers
plsql les01
plsql les01
Mehr von Chris Huang
Data compression, data security, and machine learning
Data compression, data security, and machine learning
Chris Huang
Kks sre book_ch10
Kks sre book_ch10
Chris Huang
Kks 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 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...
Chris Huang
Approaching real-time-hadoop
Approaching real-time-hadoop
Chris Huang
20130310 solr tuorial
20130310 solr tuorial
Chris Huang
Scaling 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...
Chris Huang
Wissbi osdc pdf
Wissbi osdc pdf
Chris Huang
Hbase 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 2012
Chris Huang
重構—改善既有程式的設計(chapter 12,13)
重構—改善既有程式的設計(chapter 12,13)
Chris Huang
重構—改善既有程式的設計(chapter 9)
重構—改善既有程式的設計(chapter 9)
Chris Huang
重構—改善既有程式的設計(chapter 8)part 2
重構—改善既有程式的設計(chapter 8)part 2
Chris Huang
重構—改善既有程式的設計(chapter 8)part 1
重構—改善既有程式的設計(chapter 8)part 1
Chris Huang
重構—改善既有程式的設計(chapter 7)
重構—改善既有程式的設計(chapter 7)
Chris Huang
重構—改善既有程式的設計(chapter 4,5)
重構—改善既有程式的設計(chapter 4,5)
Chris Huang
重構—改善既有程式的設計(chapter 2,3)
重構—改善既有程式的設計(chapter 2,3)
Chris Huang
重構—改善既有程式的設計(chapter 1)
重構—改善既有程式的設計(chapter 1)
Chris Huang
Mehr von Chris Huang
(20)
Data compression, data security, and machine learning
Data compression, data security, and machine learning
Kks sre book_ch10
Kks sre book_ch10
Kks sre book_ch1,2
Kks sre book_ch1,2
Real 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...
Approaching real-time-hadoop
Approaching real-time-hadoop
20130310 solr tuorial
20130310 solr tuorial
Scaling 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...
Wissbi osdc pdf
Wissbi osdc pdf
Hbase 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 2012
重構—改善既有程式的設計(chapter 12,13)
重構—改善既有程式的設計(chapter 12,13)
重構—改善既有程式的設計(chapter 9)
重構—改善既有程式的設計(chapter 9)
重構—改善既有程式的設計(chapter 8)part 2
重構—改善既有程式的設計(chapter 8)part 2
重構—改善既有程式的設計(chapter 8)part 1
重構—改善既有程式的設計(chapter 8)part 1
重構—改善既有程式的設計(chapter 7)
重構—改善既有程式的設計(chapter 7)
重構—改善既有程式的設計(chapter 4,5)
重構—改善既有程式的設計(chapter 4,5)
重構—改善既有程式的設計(chapter 2,3)
重構—改善既有程式的設計(chapter 2,3)
重構—改善既有程式的設計(chapter 1)
重構—改善既有程式的設計(chapter 1)
Kürzlich hochgeladen
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptx
MaryGraceBautista27
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)
cama23
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
Conquiztadors- the Quiz Society of Sri Venkateswara College
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
Ashokrao Mane college of Pharmacy Peth-Vadgaon
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
JoshuaGantuangco2
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
mary850239
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
Conquiztadors- the Quiz Society of Sri Venkateswara College
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
thorishapillay1
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
navabharathschool99
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choom
nelietumpap1
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
Celine George
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Celine George
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
iammrhaywood
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
Celine George
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
Humphrey A Beña
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
SpandanaRallapalli
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
TechSoup
Concurrency Control in Database Management system
Concurrency Control in Database Management system
Christalin Nelson
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
Celine George
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
9953056974 Low Rate Call Girls In Saket, Delhi NCR
Kürzlich hochgeladen
(20)
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choom
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Concurrency Control in Database Management system
Concurrency Control in Database Management system
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
重構—改善既有程式的設計(chapter 10)
1.
Classification 5/26/2011 1
Refactoring10 – Making Method Calls Simpler Allen Chien 2011-05-15
2.
Agenda Function Name
Function Parameter Private Function Constructor Exception private example(intparam) Classification 5/26/2011 2
3.
Function Name Rename
Method Classification 5/26/2011 3
4.
Function Parameters Add
Parameters Remove Parameters Separate Query From Modifier Parameterize Method Replace Parameter with Explicit Method Preserve Whole Object Replace Parameter with Method Introduce Parameter Object Classification 5/26/2011 4
5.
Private Function Hide
Method Classification 5/26/2011 5
6.
Constructor Remove Setting
Method Replace Constructor with Factory Method Encapsulate Downcast Classification 5/26/2011 6
7.
Exception Replace Error
Code with Exception Replace Exception with Test Classification 5/26/2011 7
8.
Function Name Rename
Method (忽略 “做法”) Classification 5/26/2011 8
9.
Rename Method Motivation
函式名稱應該準確表達它的用途 為函式寫上一句註釋, 然後為該註釋給予一個名稱 Example Classification 5/26/2011 9
10.
Function Parameters Add
Parameters Remove Parameters Separate Query From Modifier Parameterize Method Replace Parameter with Explicit Method Preserve Whole Object Replace Parameter with Method Introduce Parameter Object Classification 5/26/2011 10
11.
Add Parameter Motivation
修改函式後, 需要增加資訊 壞味道 :Data Clumps (P81) 建議:Introduce Parameter Object (295) Classification 5/26/2011 11
12.
Function Parameters Add
Parameters Remove Parameters Separate Query From Modifier Parameterize Method Replace Parameter with Explicit Method Preserve Whole Object Replace Parameter with Method Introduce Parameter Object Classification 5/26/2011 12
13.
Remove Parameter Motivation
修改函式後, 去除參數的重構 在多型的情況下, 需要檢查該函式是否已被其他程式實做 Classification 5/26/2011 13
14.
Function Parameters Add
Parameters Remove Parameters Separate Query From Modifier Parameterize Method Replace Parameter with Explicit Method Preserve Whole Object Replace Parameter with Method Introduce Parameter Object Classification 5/26/2011 14
15.
Separate Query from
Modifier Motivation 某個函式既回傳物件狀態值, 又修改物件狀態 (getXXX + setXXX) 既有返回值又有副作用就應該分離 (getXXX only) Meyer’s Rule: 任何有返回值的函式皆不應有副作用 優點: 增加重複查詢的效能 總是獲得相同的結果 [Allen] 函式名稱與期望結果一致 Example Classification 5/26/2011 15
16.
Classification 5/26/2011 16
17.
Classification 5/26/2011 17
Substitute Algorithm (139)
18.
Function Parameters Add
Parameters Remove Parameters Separate Query From Modifier Parameterize Method Replace Parameter with Explicit Method Preserve Whole Object Replace Parameter with Method Introduce Parameter Object Classification 5/26/2011 18
19.
Parameterize Method Motivation
問題: 某個函式做類似的工作, 但是函式本體卻包含不同的值 方式 使用單一函式, 並以參數來表達不同的值 將少量數值視為參數, 找出重覆的程式碼 優點: 減少重複的程式碼 [Allen] 與 Replace Parameter with Explicit Method 相反 Example Classification 5/26/2011 19
20.
Classification 5/26/2011 20
21.
Classification 5/26/2011 21
22.
Function Parameters Add
Parameters Remove Parameters Separate Query From Modifier Parameterize Method Replace Parameter with Explicit Method Preserve Whole Object Replace Parameter with Method Introduce Parameter Object Classification 5/26/2011 22
23.
Replace Parameter with
Explicit Methods Motivation 與Parameterize Method 相反 條件: 離散取值 函式中以條件事檢查參數 [Allen] 將 IF-ELSE 或 SWITCH 移除 [Allen] Code 不一樣 優點: 避免出現條件式 利用編譯器檢查程式 介面清楚 使用參數時, 則須判斷參數合法性 [Allen] 如 switch之default Example Classification 5/26/2011 23
24.
Classification 5/26/2011 24
25.
Function Parameters Add
Parameters Remove Parameters Separate Query From Modifier Parameterize Method Replace Parameter with Explicit Method Preserve Whole Object Replace Parameter with Method Introduce Parameter Object Classification 5/26/2011 25
26.
Preserve Whole Object
Motivation 參數為某一物件中取出, 則將該物件當作輸入參數 優點: 避免新增修改參數項 減少參數數量, 方便其他程式呼叫使用 條件: 因依存關係導致結構惡化則不可使用 Example Classification 5/26/2011 26
27.
Classification 5/26/2011 27
28.
Classification 5/26/2011 28
29.
Function Parameters Add
Parameters Remove Parameters Separate Query From Modifier Parameterize Method Replace Parameter with Explicit Method Preserve Whole Object Replace Parameter with Method Introduce Parameter Object Classification 5/26/2011 29
30.
Replace Parameter with
Methods Motivation 物件換起某個函式, 並將所得結果作為參數, 傳遞給另一個函式 接受該參數的函式也可以喚起前一個函式 條件: 接收端是否可以透過計算而取得函數值 優點: 減少參數數量 使函式容易理解 Example Classification 5/26/2011 30
31.
Classification 5/26/2011 31
32.
Classification 5/26/2011 32
Inline Method (117)
33.
Function Parameters Add
Parameters Remove Parameters Separate Query From Modifier Parameterize Method Replace Parameter with Explicit Method Preserve Whole Object Replace Parameter with Method Introduce Parameter Object Classification 5/26/2011 33
34.
Introduce Parameter Object
Motivation 一組參數一起被傳遞 將一組參數組織再一起 [Allen] 解決 Add Parameter 的問題 優點: 減少參數量 找出部分程式碼可移到輸入的類別中 Example Classification 5/26/2011 34
35.
Classification 5/26/2011 35
36.
Classification 5/26/2011 36
37.
Classification 5/26/2011 37
38.
Classification 5/26/2011 38
[Allen] 直接存取物件內的資料 _start _end
39.
Private Function Remove
Setting Method Hide Method Classification 5/26/2011 39
40.
Hide Method Motivation
類別中某一函式從來沒有被其他類別使用 利用IDE工具找出是否有被外部程式Reference 若沒有則將其設為Private function
41.
Constructor Remove Setting
Method Replace Constructor with Factory Method Encapsulate Downcast Classification 5/26/2011 41
42.
Remove Setting Method
Motivation 物件中某欄位, 應該在初創時被設置, 然後不再改變 如果不希望再被改變, 則直接不提供 setXXX [Allen] 專用於Final 的變數 Example Classification 5/26/2011 42
43.
Constructor Remove Setting
Method Replace Constructor with Factory Method Encapsulate Downcast Classification 5/26/2011 43
44.
Replace Constructor with
Factory Method Motivation 當需要使用 Type Code 創建建構式 使用Factory Method實做建構式 [Allen] 依照不同Type有不同行為時 Example * 3 Classification 5/26/2011 44
45.
46.
Encapsulate Downcast Motivation
優點: 將轉型動作封裝 [Allen] 避免外部程式自行轉型 Example Classification 5/26/2011 49
47.
Classification 5/26/2011 50
48.
Exception Replace Error
Code with Exception Replace Exception with Test Classification 5/26/2011 51
49.
Replace Error Code
with Exception Motivation [Allen] 與Replace Error Code with Exception相反 優點: 將異常與一般程式分開 Example Classification 5/26/2011 52 平行
50.
Classification 5/26/2011 53
說明清楚
51.
Overview Exception Replace
Error Code with Exception Replace Exception with Test Classification 5/26/2011 54
52.
Replace Exception with
Test Motivation [Allen] 與Replace Error Code with Exception相反 避免Exception濫用 呼叫函式前先檢查必要條件 Example Classification 5/26/2011 55
53.
Classification 5/26/2011 56
54.
Classification 5/26/2011 57
55.
Classification 5/26/2011 58
56.
Summary Classification 5/26/2011
59
57.
Thank YOU
! Classification 5/26/2011 60
Jetzt herunterladen