Skip to content

Latest commit

 

History

History
23 lines (17 loc) · 747 Bytes

README.md

File metadata and controls

23 lines (17 loc) · 747 Bytes

Refactoring Like a Pro

What is refactoring?

  • A change made to the internal structure of software to make it:
    • Easier to understand.
    • Cheaper to make future changes.
  • This does not change the observable behavior of the software.
  • Tests help ensure that we didn't change behavior.

Why do we refactor?

  • Software left alone will decay.
  • Makes it cheaper to make changes.
  • Make it easier to understand.
  • Improves the design of the code.

Common refactoring techniques:

  1. Change names to communicate intent
  2. No magic numbers / variables
  3. One responsibility per function / class
  4. Do not be obsessed with primitives