Skip to content

Instantly share code, notes, and snippets.

@tanvirraj
Created May 4, 2015 18:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tanvirraj/774c0cbe65ea9a84f49a to your computer and use it in GitHub Desktop.
Save tanvirraj/774c0cbe65ea9a84f49a to your computer and use it in GitHub Desktop.
Table of Contents
Introduction
Code Smells
Long Method
Large Class
Feature Envy
Case Statement
High Fan-out
Shotgun Surgery
Divergent Change
Long Parameter List
Duplicated Code
Uncommunicative Name
Single Table Inheritance (STI)
Parallel Inheritance Hierarchies*
Comments
Mixin
Callback
Solutions
Replace Conditional with Polymorphism
Replace conditional with Null Object
Extract method
Rename Method
Extract Class
Extract Value Object
Extract Decorator
Extract Partial
Extract Validator
Introduce Explaining Variable
Introduce Observer
Introduce Form Object
Introduce Parameter Object
Use class as Factory
Move method
Inline class
Inject dependencies
Replace Subclasses with Strategies
Replace mixin with composition
Replace Callback with Method
Use convention over configuration
Introduce Visitor
Principles
DRY
Single responsibility principle
Tell, Don’t Ask
Law of Demeter
Composition over inheritance
Open/closed principle
Dependency inversion principle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment