GoConqr has a new look! Let us know what you think.

Mind map

Refactoring

Caio Serrano Portuguese

Refactoring

Map content

Refactoring

  1. What is the first step to refactor the code

    • Feeling the code smell
      • Bloaters
        • Long method (The method does many things, so the things are complex )
        • Large Class (The class does many things, she are the main in the code)
        • Primitive obsession (program constants are like the constants in language C)
        • Long parameter list (more than 4 parameters in method)
        • Data Clumps (Using the same data like in others methods??)
      • O.O Abusers
        • Switch Statment (Why complicate the "if" or "switch"?)
        • Temp field (A value only for the moment)
        • Refused Bequest (This is a cat, but why are you asking me about dog?)
        • Alternative class (two class different but does the same things)
      • Change Preventers
        • Shotgun Surgery ( Any modifications require a lot of changes )
        • Divergent Change (For make a simple change in method, you need change a lot of things)
        • Parallel Inheritance Hierarchies (The same subclass for this inheritance?)
      • Dispensables
        • Lazy Class (Why this class doesn't does anything?)
        • Dead Code (Yep, we don't use that)
        • Duplicate code (Copy and paste dude!)
        • Comments (for understand the code, right?)
        • Date Class (holding the information for what?)
        • Speculative Generality (Will be that someday we will need?)
      • Couplers
        • Feature Envy (I want that cookie!)
        • Inappropriate Intimacy (I want it all!!!!)
        • Message Chains (A->B->C)
        • Middle Man (Ok, i am the mediator!)
        • Lib Incomplete
    • What is the second step to refactor the code
      • Apply the refactoring in the code
        • This don't change the behavior of code
        • Composing Methods
          • Extract Method (Method is very long or does various things)
          • Inline Method (put all in only one)
          • Extract Variable (the expression is complex)
          • Inline Temp (Temporary field?)
          • Replace Temp with Query ( Eliminate the variables in method)
          • Split Temporary Variable ( Don't reuse the variable)
          • Remove Assignments to Parameters (Alter the parameter in method)
          • Replace Method with Method Object ( When you can't use Extract Method)
          • Substitute the Algorithm
        • Moving feature between Objects
          • Move Method (the method use more other class)
          • Move field (Another class uses more than the class it's)
          • Extract Class ( He has a lot of features)
          • Inline Class (Why a lot of class?)
          • Hide delegation (A->B and B->A)
          • Remove middle man (Problem with delegation)
          • Introduce foreign method (You can't create a new method inside of class?)
          • Introduce Local Extension (Extend the class)
        • Organizing Data
          • Self Encapsulate Field (Create getter and setter)
          • Replace Data Value with Object (The value change much?)
          • Change Value to Reference and reverse (The field is a reference or Value?)
          • Replace Array with Object (Is possible the array run out?)
          • Duplicate Observed Data (Split the interface)
          • Change Unidirectional Association to Bidirectional and reverse (Do you need access this class?)
          • Replace Magic Number with Symbolic Constant ( Like in C)
          • Encapsulate Field (Use OO principles)
          • Encapsulate Collection (Now in Enum)
          • Replace Type Code with Class or Subclass or State (Take your strategy!)
        • Simplifying Conditional Expressions
          • Decompose Conditional (Decompose a complex switch)
          • Consolidate Conditional Expression ( join the "options")
          • Consolidate Duplicate Conditional Fragments (Use the same option in return on if and else)
          • Remove Control Flag ( Use Break and Continue)
          • Replace Nested Conditional with Guard Clauses (Only ifs?)
          • Replace Conditional with Polymorphism (Hey man, I can see the Inheritance !)
          • Introduce Null Object (For objects standard)
        • Simplifying Method Calls
          • Rename Method (The method say what he gonna does?)
          • Add Parameter (Incomplete?)
          • Remove Parameter
          • Separate Query from Modifier ( Don't join the getter and setter)
          • Parameterize Method (Standard the parameter)
          • Replace Parameter with Explicit Methods (The parameter is a new method)
          • Preserve Whole Object (Create a new object for these values)
          • Replace Parameter with Method Call
          • Introduce Parameter Object (method call)
          • Remove Setting Method (He doesn't affect in anything)
          • Hide Method (Anyone want me ?)
          • Replace Constructor with Factory Method (Ever constructor create a new object)
          • Replace Error Code with Exception (Use OO principles)
        • Dealing with Generalisation
          • -All- Push up (push the field, constructor or method to superclass)
          • Push Down(Inverse of push up)
          • Extract subclass or superclass (Like a Extract class)
          • Replace Inheritance with Delegation
          • Form Template Method
          • Collapse Hierarchy

Images and files in the map

  • Refactoring
  • Refactoring
  • Refactoring
  • Refactoring
  • Refactoring

Information

Description
Mind Map on Refactoring, created by Caio Serrano on 03/06/2015.
Created by
Caio Serrano
Views
1
Rating

Feedback

What is it about?

What do you think of the new look?

How do you like it?