Your SlideShare is downloading. ×
0
Refactoring<br />Prepared by YuriySeniuk<br />
Software evolution<br />
Causes for refactoring<br />Code duplicating;<br />Huge method;<br />Huge or deep loops;<br />Bad class coherency; <br />B...
Causes for refactoring<br />It’s necessary to make changes in several classes;<br />It’s necessary to change several hiera...
Causes for refactoring<br />Class has limited functionality;<br />Method gets Tramp data;<br />One class knows too much ab...
Data Refactoring<br />Magic numbers;<br />Unlucky variable name; <br />Temporary variable using;<br />Multiple usage of th...
Operator Refactoring<br />Decomposition of expression;<br />Extract Boolean methods;<br />Immediate exit from method;<br /...
Methods Refactoring<br />Method extraction;<br />Inline method;<br />Class extraction from huge methods;<br />Additional p...
Class Refactoring<br />Value to Reference types replacement;<br />Reference to Value types replacement;<br />Move fields/p...
Class Refactoring<br />Replace inheritance to delegating;<br />Replace delegating to inheritance;<br />Data encapsulating;...
Safe Refactoring<br />Save original code;<br />Make refactoring step-by-step;<br />Create list of actions;<br />Create To-...
Bad causes to do refactoring<br />Do not expect refactoring to correct your code;<br />Do not wait for some magic from ref...
Refactoring strategies<br />Use refactoring when you:<br />Create new methods;<br />Create new classes;<br />Fix defects;<...
Refactoring strategies<br />
Q&A<br />?<br />
Upcoming SlideShare
Loading in...5
×

Refactoring

934

Published on

Published in: Technology, Sports
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
934
On Slideshare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
14
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Refactoring"

  1. 1. Refactoring<br />Prepared by YuriySeniuk<br />
  2. 2. Software evolution<br />
  3. 3. Causes for refactoring<br />Code duplicating;<br />Huge method;<br />Huge or deep loops;<br />Bad class coherency; <br />Bad interface agreement (Interface monster);<br />Too many parameters in method;<br />Too much class’s responsibilities;<br />
  4. 4. Causes for refactoring<br />It’s necessary to make changes in several classes;<br />It’s necessary to change several hierarchies;<br />It’s necessary to make changes in several case blocks;<br />Coherent data placed not in a class;<br />Method use more parameters from other class than its;<br />Elementary type is overload;<br />
  5. 5. Causes for refactoring<br />Class has limited functionality;<br />Method gets Tramp data;<br />One class knows too much about another one;<br />Method has unlucky name;<br />Public fields;<br />Inherited class used small dime of base methods;<br />Code Comments;<br />Class contains methods that could be some time;<br />
  6. 6. Data Refactoring<br />Magic numbers;<br />Unlucky variable name; <br />Temporary variable using;<br />Multiple usage of the same variable;<br />Enum usage;<br />Basic type expansion;<br />
  7. 7. Operator Refactoring<br />Decomposition of expression;<br />Extract Boolean methods;<br />Immediate exit from method;<br />Polymorphism usage;<br />Dummy objects usage;<br />
  8. 8. Methods Refactoring<br />Method extraction;<br />Inline method;<br />Class extraction from huge methods;<br />Additional parameters usage;<br />Redundant parameters deletion; <br />Pass whole class instead of several parameters;<br />Return base classes;<br />
  9. 9. Class Refactoring<br />Value to Reference types replacement;<br />Reference to Value types replacement;<br />Move fields/properties/methods to base class;<br />Move fields/properties/methods to inherited class;<br />Move methods to another class;<br />Split one class to many;<br />Delete useless class;<br />Use extension methods;<br />
  10. 10. Class Refactoring<br />Replace inheritance to delegating;<br />Replace delegating to inheritance;<br />Data encapsulating;<br />Unite inherited and base class.<br />
  11. 11. Safe Refactoring<br />Save original code;<br />Make refactoring step-by-step;<br />Create list of actions;<br />Create To-Do list;<br />Create check points;<br />Monitor warnings from compiler;<br />Make change-reviews.<br />
  12. 12. Bad causes to do refactoring<br />Do not expect refactoring to correct your code;<br />Do not wait for some magic from refactoring.<br />
  13. 13. Refactoring strategies<br />Use refactoring when you:<br />Create new methods;<br />Create new classes;<br />Fix defects;<br />Create refactoring in bug’s potential code;<br />Create refactoring in complicated modules.<br />
  14. 14. Refactoring strategies<br />
  15. 15. Q&A<br />?<br />
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×