Skip to content

Instantly share code, notes, and snippets.

@notionquest
Last active November 20, 2019 12:13
Show Gist options
  • Save notionquest/d33bbe43aed1f1a51d63dec6a181bd40 to your computer and use it in GitHub Desktop.
Save notionquest/d33bbe43aed1f1a51d63dec6a181bd40 to your computer and use it in GitHub Desktop.
Refactoring code

Basics:-

  1. Names are important
  2. Replace condition with Polymorphism i.e. create subclass for each variation
  3. Remove duplicated code i.e. DRY - Don't Repeat Yourself principle
  4. Yagni ( "You Aren't Gonna Need It" ) - Extreme Programming - i.e. Don't design or code anything for future requirements because it may not be required
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment