Refactoring
Upcoming SlideShare
Loading in...5
×
 

Refactoring

on

  • 1,197 views

 

Statistics

Views

Total Views
1,197
Views on SlideShare
1,000
Embed Views
197

Actions

Likes
0
Downloads
11
Comments
0

11 Embeds 197

http://yuriyseniuk.blogspot.com 173
http://yuriyseniuk.blogspot.de 4
http://yuriyseniuk.blogspot.com.es 3
http://yuriyseniuk.blogspot.com.br 3
http://www.linkedin.com 3
http://yuriyseniuk.blogspot.co.uk 3
http://yuriyseniuk.blogspot.be 2
http://yuriyseniuk.blogspot.ca 2
http://yuriyseniuk.blogspot.it 2
http://yuriyseniuk.blogspot.com.au 1
http://www.yatedo.com 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Refactoring Refactoring Presentation Transcript

  • Refactoring
    Prepared by YuriySeniuk
  • Software evolution
  • 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;
  • 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;
  • 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;
  • Data Refactoring
    Magic numbers;
    Unlucky variable name;
    Temporary variable using;
    Multiple usage of the same variable;
    Enum usage;
    Basic type expansion;
  • Operator Refactoring
    Decomposition of expression;
    Extract Boolean methods;
    Immediate exit from method;
    Polymorphism usage;
    Dummy objects usage;
  • 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;
  • 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;
  • Class Refactoring
    Replace inheritance to delegating;
    Replace delegating to inheritance;
    Data encapsulating;
    Unite inherited and base class.
  • 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.
  • Bad causes to do refactoring
    Do not expect refactoring to correct your code;
    Do not wait for some magic from refactoring.
  • 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.
  • Refactoring strategies
  • Q&A
    ?