CoderKungfu / refactoring_php_demo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About


Languages

Language:PHP 77.6%Language:HTML 22.4%