In this article, we will learn what is solid? Why should we use solid design principle?.
What is SOLID? Why should we use SOLID principle?
What is SOLID:
SOLID is basically design principle. which is used to create good software Architecture to develop a good software.
S.O.L.I.D is an acronym for the first five object-oriented design(OOD) principles by Robert C. Martin, popularly known as Uncle Bob.
What is meant by good software?
What is meant by good software?
The software has a good structure that is flexible, maintainable, and reusable.
These principles, when combined together, make it easy for a programmer to develop software that is easy to maintain and extend.
Why should we use SOLID design Principles?
To avoid the symptoms of poor design, or design smells.
Symptoms of poor design, or design smells:
• Rigidity: (The design is difficult to change)
A design is rigid if a single change causes a cascade of subsequent changes in independent modules. The more modules that must be changed, the more rigid the design.
• Fragility: (The design is easy to break)
Fragility is the tendency of a program to break in many places when a single change is made.
The design is difficult to reusable.
• Viscosity: (The design is difficult to do the right thing.)
It is easy to do the wrong thing but difficult to do the right thing.
• Needless repetition:
When the same code appears over and over again, in slightly different forms, the developers are missing an abstraction. Finding all the repetition and eliminating it with an appropriate abstraction
may not be high on their priority list, but it would go a long way toward making the system easier to understand and maintain.
When there is redundant code in the system, the job of changing the system can become difficult.
Bugs found in such a repeating unit have to be fixed in every repetition. However, since each repetition is slightly different from every other, the fix is not always the same.
An advantage of the SOLID principle or How do we know how whether the design of a software system is good?
• The design is easy to change.
• The design is easy to Flexible and Extensible
• The design is easy to Testable
• The design is easy to Reusable
• The design is easy to avoid the needless repetition
• The design is easy to do the right thing
The principles are there to help us eliminate bad smells. They are not a perfume to be liberally scattered all over the system. Over-conformance to the principles leads to the design smell of needless complexity.
S.O.L.I.D Stand for:
S: Stand for Single Responsibility Principle (SRP)
O: Stand for Open Close Principle (OCP)
L: Stand for Stand for Liscko Substitution Principle (LSP)
I: Stand for Interface Segregation Principle (ISP)
D: Dependency Inversion Principle (DIP)
We will go with one by one principle in detail with the example of the solid principle in the next article of this series.
I hope you understood the basic knowledge of what SOLID Is and Why should we use and advantages of using it.
If you like my article then please add your valuable comment on below comment box that will encourage me a lot to writing more and more articles.