Jump to content

James Bob Lawless

  • Posts

  • Joined

  • Last visited

Community Answers

  1. James Bob Lawless's post in Refactoring was marked as the answer   
    Code Refactoring is method of improving or updating the codes without changing the output and/or functionality of the solution.
    A team must consider doing code refactoring is before making or adding any updates or new features to exisiting codes. Looking back and cleaning the exisiting code before adding in new will not only enhance te quality of the solution, but it will also make it easier for other developers to build on to the original codes.
    Code Refactoring may not be avoidable in projects. However, these are the Main Techniques:
    1. Red-Green Refactor - widely used in Agile Test-Driven Development. It breaks into 3 distinct steps
          1.1 Stop and Consider what's required (RED)
          1.2 Pass Basic Testing (GREEN)
          1.3 Impose Improvements (REFACTOR)
    2. Refactoring by Abstraction - used for large scale refactoring to be done. It involves inheritance of class, order/hierarchy and extraction. The main purpose of abstraction is to minimize unnecessary duplication of codes (e.g. Pull-Up / Push-Down).
    3. Composing Method - It involves streamlining of codes resulting to reduction of duplicates. Done through numerous processes, including "Extraction" and "Inline Methods".
    4. Simplifying Method - It involves tweaking the interaction and relationship between classes. Adding, Removing and Introducing new parameters together with changing parameters with explicit methods and calls are all aspect of simplification.
    5. Moving Between Objects - It involves making new classes and moving functionality between old & new classes.
    6. Preparatory Refactoring - This is done when a software developer notices the need for refactoring, while adding new feature(s). By doing-so, the developer is minimizing future debugging or technical debt.
    Code Refactoring is keeping a clean, orderly and streamlined codes.  Do regular cleaning on your codes and you will hve better solution and productive work environment.
  • Create New...