Skip to main content

What are SOLID principles ?

  • S (Single-responsiblity Principle): A class or function or component should have only one job.
  • O (Open-closed Principle): Objects or entities should be open for extension but closed for modification.
  • L (Liskov Substitution Principle): Let p(x) be a property provable about objects of x of type T. Then p(y) should be provable for objects of y of type S where S is a subtype of T.
  • I (Interface Segregation Principle): A client should never be forced to implement an interface that it doesn’t use, or clients shouldn’t be forced to depend on methods they do not use.
  • D (Dependency Inversion Principle): Entities must depend on abstractions, not on concretions. It states that the high-level module must not depend on the low-level module, but they should depend on abstractions.