SOLID Principles: What are they and Why Developers must adopt them

SOLID principles are one of the most popular set of design principles in object-oriented principles. S.O.L.I.D is an acronym for the first five object-oriented design (OOD) principles by Robert C. Martin.
These principles help developers to develop the software that is easy to maintain and extend.
S.O.L.I.D stands for
S — Single Responsibility Principle (SRP)
O — Open Closed Principle (OCP)
L — Liskov Substitution Principle (LSP)
I — Interface Segregation Principle (ISP)
D — Dependency Inversion Principle (DIP)
Single Responsibility Principle
It is also known as SRP. It states ” A class should have only one reason to change”. It means A class should perform only one job.
Open Closed Principle
Software entities like classes, modules and functions should be open for extension but closed for modifications.
The Open Close Principle states that the design and writing of the code should be done in a way that new functionality should be added with minimum changes in the existing code. The design should be done in a way to allow the adding of new functionality as new classes, keeping as much as possible existing code unchanged.
Liskov Substitution Principle
Methods or Classes that use references to base classes must be able to use objects of derived classes without knowing it.
Interface Segregation Principle
Clients should not be forced to depend upon interfaces that they don’t use.
The Interface Segregation Principle states that clients should not be forced to implement interfaces they don’t use. Instead of one fat interface, many small interfaces are preferred based on groups of methods, each one serving one submodule.
Dependency Inversion Principle
High-level modules should not depend on low-level modules. Both should depend on abstractions.
Abstractions should not depend on details. Details should depend on abstractions.

