Skip to content

Latest commit

 

History

History
54 lines (38 loc) · 1.94 KB

solid.md

File metadata and controls

54 lines (38 loc) · 1.94 KB
title updated permalink
SOLID
December 8, 2016
/articles/oop/solid/

SOLID is a collection of good programming practices for object oriented programming and consists of 6 principles. These aren't the rules you should be following strictly everywhere. These are more like best practices you should use if possible and understand. If there will be better practices found and developed besides these, they will be extended or explained in a separate chapters also.

SOLID stands for:

  • S as Single responsibility principle
  • O as Open/close principle
  • L as Liskov segregation principle
  • I as Interface segregation principle
  • D as Dependency inversion principle

Single Responsibility Principle (SRP)

Single responsibility principle states that each class or module should have one and only one role or responsibility.

Open/Close Principle (OC)

Open/close principle states that each class should be open for extension and at the same time closed for modification.

Liskov Segregation Principle (LSP)

Liskov segregation principle states that objects should be replaceable with instances of any of their parent classes.

Interface Segregation Principle (ISP)

Interface segregation principle states that classes should not be limited and locked for accepting more of their kind.

Dependency Inversion Principle

Dependency inversion principle states that classes should depend on abstractions rather than only certain class dependencies. Abstraction should be implemented without detailed functionality so classes can use the abstraction and extend it accordingly.

See Also

The following resources are advised to read beside this article to get different explanation and to know more about the SOLID principles.