• Like
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.



Published in Technology , Sports
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads


Total Views
On SlideShare
From Embeds
Number of Embeds



Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

    No notes for slide


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