Skip to main content
  1. Refs/

SOLID Principles

··3 mins

Go to References #

Videos #

  • Bob Martin SOLID Principles of Object Oriented and Agile Design
  • Software Design - Introduction to SOLID Principles in 8 Minutes - Quick, concise, and clear examples of each of the SOLID principles (though examples are simple and bookish):
    • Single Responsibility - one reason to change; should be able to explain in a single sentence what this thing does
    • Open Closed - closed for modification / open for extension (should not have to update if-else/switch blocks every time new types are added)
    • Liskov Substitution - subtypes should be able to be swapped in for their base type –> should not unnecessarily overuse inheritance
    • Interface Segregation - interfaces should be small –> should not have DUMMY implementations
    • Dependency Inversion - objects should be created by caller, and callee should accept parent/generic types
  • SOLID Design Principles in java with Example | JavaTechie - Longer explanation of SOLID principles with more realistic examples

Single Responsibility #

  • Robert C Martin - The Single Responsibility Principle | JavaTechie - Main issues with poorly structured code:
    • Rigidity: tendency of the system to resist change, by forcing you to make the change in multiple places
    • Fragility: a fix/change in one part of the codebase impacts an unrelated part of the codebase
      • long distance couplings
      • thing changed has multiple responsibilities that might seem similar, but are different

Open Closed #

Liskov Substitution #

Interface Segregation #

Dependency Inversion #