+ All Categories
Home > Documents > Refactoring Notes

Refactoring Notes

Date post: 24-Dec-2015
Category:
Upload: cgty-ulsy
View: 29 times
Download: 1 times
Share this document with a friend
Description:
Code refactoring
Popular Tags:
8
1- Extract Method Code Smells -> Extract Method 1- Long methods 2- Comments If a section needs a comment to explain it instead of commenting write a new method
Transcript

1- Extract Method

Code Smells -> Extract Method

1- Long methods2- Comments

If a section needs a comment to explain it instead of commenting write a new method

Inline Method Refactoring

Replace temp with Query

Dont use the same temp for different reasons! -> Split Temporaryi Variable!

Introduce Explaining Variable -> Pure readibility

Remove Assignments to Parameters: (Beware of the impact of any change to the assignment)

“feature envy” a method is more interested in reaching into a different class accessing data.

REPLACE CONDITIONAL WITH POLYMORPHISM

REPLACE TYPECODE WITH SUBCLASSES!

Minimize parameter list!

Avoid doing more than at the same method -> split queries!

1- LENGTH 2- COMMENTS 3- CHECK SWITCH STATEMENTS


Recommended