Why S.O.L.I.D when we have OOP Principles ?


(Reading time : 1 min)


Most of us know that ,
S.O.L.I.D stands for

Single Responsibility Principle
Open / Closed Principle
Liskov Substitution Principle
Interface Segregation Principle
Dependency Inversion Principle

where as , OOP has the following

Encapsulation
Abstraction
Inheritance
Polymorphism.

But what made us have two concepts like this. Is SOLID a subset of OOP ?
Well the answer for this question is simple.

There are certain languages that do not follow concepts such as Encapsulation, Abstraction, Inheritance and Polymorphism i.e. not Object Oriented . When coding with a such a language such as C, COBOL,FOTRAN and PASCAL or any other procedural language we can’t follow OOP . But if you are using an Object Oriented language , it is necessary to follow these principles.


In return. SOLID is optional. When coding , it is best to follow SOLID principles but avoiding it will not do any harm to your code.

Comments