Refactoring

Topics 

  • What is and Why refactoring? 
  • Things to refactor 
  • Refactoring legacy code 
  • How to improve your refactoring skills?

What is and Why Refactoring?

What is refactoring? 

  • A series of small steps, each of which changes the program's internal structure without changing its external behavior (Martin Fowler) 
    • Verify “no change in external behavior” by Unit testing 
  • Example scenarios that require refactoring 
    • Code smells 
    • We have too much duplicate code 
    • The class is too big 
    • ...

Why refactoring? 

  • Helps us deliver more business value faster
  • Minimize technical debt 
    • To “fix broken windows” (Pragmatic Programmers) 
  • Improves the design of the our software 
    • Easier to maintain and understand 
    • Easier to facilitate change 
    • Increased re-usability
  • Understand unfamiliar code 
  • To help find bugs

You must have an active subscription to download PDF and Lab Zip of this course topic.Please click the "Subscribe" button or the "Login" button if you already have an account.