Classes are mainly the building blocks of any Software or application. If these blocks are not designed properly, the application or software is going to face a tough time in the future in terms of maintenance. This essentially means that not so well-written classes can lead to very difficult situations when the application scope goes up or application faces certain design issues either in production or maintenance.
In this tutorial, we will discuss the SOLID principle in Java. which has 5 most recommended design principles; we should keep in mind while these principles while writing the classes. They also make good practices to be followed for designing our application classes.
Robert C. Martin had given five object-oriented design principles and the acronym “S.O.L.I.D” came into the picture.
The following 5 concepts make up SOLID principles:
Click on the above hyperlink to know more detail about Each principle
Table of Contents
SOLID Design Principles
|S||Single Responsibility Principle (SRP)||A class should have one and only one responsibility|
|O||Open-Closed Principle (OCP)||Software components should be open for extension but closed for any modification|
|L||Liskov’s Substitution Principle (LSP)||Derived types must be completely substitutable for their base(super) type|
|I||Interface Segregation Principle (ISP)||Clients should not be forced to implement unnecessary methods which they do not want to use|
|D||Dependency Inversion Principle (DIP)
|Software components depend on abstractions (interfaces and abstract classes) instead of concrete implementations (classes).|
You May Also Like:
That’s all about SOLID Design Principles
If you have any feedback or suggestion please feel free to drop in below comment box.