REFACTORING: IMPROVING
THE DESIGN OF EXISTING
CODE
Review by AKSHAY G RAO
Name:
REFACTORING: IMPROVING THE
DESIGN OF EXISTING CODE
Authors:
Martin Fowler
Contributors:
Kent Beck, John Brant, William
Opdyke, Don Roberts
Link:
https://drive.google.com/open?id=1eyG
WCdiCwY-
LW4ayYKnkkreEZvfmm0Mr
What is Refactoring
• Refactoring is the process of changing the internal structure of the
software system in a way that the external behavior of the code won’t
change.
Advantages of refactoring:
• Refactoring improves design of existing code.
• Refactoring makes software easier to understand
• Refactoring helps find bugs
• Refactoring helps program faster
When should you refactor
• Refactoring should be done majorly during two distinct activities of development
1. Before adding a functionality
2. After adding functionality.
Problems with refactoring
• Refactoring is hard to perform on databases.
• Refactoring is not easy while using published interfaces.
When shouldn’t we refactor
• Refactoring shouldn’t be attempted when you are close to a deadline
• Refactoring is not encouraged when the existing code is extremely unstructured
and doesn’t work on all test cases.
BAD PROGRAMMING PRACTICES
• Duplication of Code
• Long Method
• Large Class
• Long Parameter List
• Divergent Change
• Shotgun Surgery
• Feature Envy
• Switch Statements
• Message Chains
• Lazy Class
• Middle Man
Conclusion
• The author illustrates various principles to perform refactoring in a step-
by-step manner.
• The author has described the role of refactoring in many large complex
systems that he had dealt with and has illustrated various implementation
techniques available to solve a given problem.
• The author has provided parts of the puzzle in the form of catalogs and a
list of refactoring strategies. It is up to the reader to glue all the parts
together in right proportions as per circumstances and build a good
system.
THANK YOU
References
• Refactoring Browser Tool: https://refactory.com/refactoring-browser/
• Thesis paper of William F.Opdyke:
https://laputan.org/pub/papers/opdyke-thesis.pdf