Skip to content

Latest commit

 

History

History
15 lines (12 loc) · 717 Bytes

solid.md

File metadata and controls

15 lines (12 loc) · 717 Bytes

SOLID principles

  • S = Single Responsibility - Each class/instance should have only 1 responsibility
  • O = Open Closed - Objects should be open for extension closed for modification
  • L = Liskov substitution - Instance objects can be replaced with subtypes without altering correctness
  • I = Interface Segregation - Multiple specific interfaces are better than big general one
  • D = Dependency Injection - High level and Low level modules should both depend on abstraction

Other design principles

  • Code to interface not implementation
  • Favor composition over inheritance
  • Encapsulate what changes
  • Strive for loose coupling between objects
  • Principle of least knowledge = Talk only to immediate friends