28. • Refactoring (Noun )
– A change made to the internal structure of
software to make it easier to understand and
cheaper to modify without changing its observable
behavior. (對軟體內部結構的一種改變,目的在不改動軟體可察覺行
為的前提之下,提高其可理解性並降低修改成本。)
• Refactor (Verb)
– To restructure software by applying a series of
refactoring without changing its observable
behavior. (在不改變軟體可察覺行為的前提之下使用一系列重構方法
調整軟體結構 。)
Copyright@2012-2016 Teddysoft Source:《Refactoring》
40. A change made to the internal structure
of software to make it easier to
understand and cheaper to modify
without changing its observable behavior.
較易理解,較低修改成本
Copyright@2012-2016 Teddysoft
3
42. Understandability
Modifiability
Low Coupling
High Cohesion
OO Concept
OO Principle
Design Pattern
Architecture
Abstraction
Information hiding
Polymorphism
Responsibility
assignment
Indirection
Separation of concerns
Program to an interface,
not an implementation
Favor object composition
over class inheritance
Single-responsibility
Open-closed
Liskov substitution
Interface-segregation
Dependency-inversion
Don't repeat yourself,
Single choice, One and
only once
Copyright@2012-2016 Teddysoft
50. • Make you instant expert
• Eliminate the need for intelligence and
taste
• Eliminate the need to think
• Tell you how exactly how to adapt the
solution to your context
Copyright@2012-2016 Teddysoft
Source: Asian PLoP 2016 by Joseph
Yoder and Rebecca Wirfs-Brock
51. Copyright@2012-2016 Teddysoft
重構 相反重構
Extract Method Inline Method
Add Parameter Remove Parameter
Collapse Hierarchy Extract Superclass, Extract Subclass
Extract Class Inline Class
Hide Delegate Remove Middle Man
Pull Up Field Push Down Field
Replace Inheritance with Delegation Replace Delegation with Inheritance