Skip to content

Instantly share code, notes, and snippets.

@sl4m
Created March 8, 2010 21:59
Show Gist options
  • Save sl4m/325812 to your computer and use it in GitHub Desktop.
Save sl4m/325812 to your computer and use it in GitHub Desktop.
SOLID =>
Single Responsibility Principle (SRP) => object should only have single responsiblity
Open/Closed Principle (OCP) => should be open for extension , but closed for modification
Liskov Substitution Principle (LSP) => design by contract
Interface Segregation Principle (ISP) => many client interfaces are better than one general purpose interface
Dependency Injection Principle (DIP) => one should 'depend upon abstractions, not depend upon concretions'
http://en.wikipedia.org/wiki/Solid_%28Object_Oriented_Design%29
Code smell - http://en.wikipedia.org/wiki/Code_smell
Types of code smell
God object => anti-pattern where an object knows too much, does too much (e.g., large class)
http://en.wikipedia.org/wiki/God_object
Feature envy => a class that uses methods of another class excessively
Inappropriate intimacy => a class that has dependencies on implementation details of another class
Refused bequest => a class that overrides a method of a base class in such a way that the contract of the base class is not honored by derived class. see Liskov substitution principle
Lazy class => a class that does too little
Duplicated method => a method, function, or procedure that is very similar to another
Contrived Complexity => forced usage of overly complicated design patterns where simpler design would suffice
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment