Difference between revisions of "SOLID Principles"

From JholJhapata
(Creating SOLID Principles)
 
 
(9 intermediate revisions by the same user not shown)
Line 2: Line 2:
  
 
It was introduced by Robert C. Martin.
 
It was introduced by Robert C. Martin.
 
The intention of these principles is to make software designs more understandable, easier to maintain and easier to extend.
 
  
 
When the developer builds a software following the bad design, the code can become inflexible and more brittle, small changes in the software can result in bugs. For these reasons, we should follow SOLID Principles. '''It’s intention is to make software designs more understandable, easier to maintain and easier to extend'''.  
 
When the developer builds a software following the bad design, the code can become inflexible and more brittle, small changes in the software can result in bugs. For these reasons, we should follow SOLID Principles. '''It’s intention is to make software designs more understandable, easier to maintain and easier to extend'''.  
Line 9: Line 7:
 
In this article, I will be covering these principles with examples of how they are violated, and how to correct them so they are compliant with SOLID Principles.
 
In this article, I will be covering these principles with examples of how they are violated, and how to correct them so they are compliant with SOLID Principles.
  
Let’s go through each principle one by one:
+
== Concepts ==
S Single responsibility principle
+
Let’s go through each principle one by one:<br>
O Open/closed principle
+
'''S''' - [[Single Responsibility Principle|Single responsibility principle]]<br>
L Liskov substitution principle
+
'''O''' - [[Open-Closed Principle|Open/closed principle]]<br>
I Interface segregation principle
+
'''L''' - [[Liskov Substitution Principle|Liskov substitution principle]]<br>
D - Dependency inversion principle
+
'''I''' - [[Interface Segregation Principle|Interface segregation principle]]<br>
 +
'''D''' - [[Dependency Inversion Principle|Dependency inversion principle]]

Latest revision as of 17:30, 16 August 2019

SOLID Principles are the 5 most important design principles when doing Object Oriented Programming(OOP). We should have a clear concept of this for developing software in a proper way to avoid a bad design.

It was introduced by Robert C. Martin.

When the developer builds a software following the bad design, the code can become inflexible and more brittle, small changes in the software can result in bugs. For these reasons, we should follow SOLID Principles. It’s intention is to make software designs more understandable, easier to maintain and easier to extend.

In this article, I will be covering these principles with examples of how they are violated, and how to correct them so they are compliant with SOLID Principles.

Concepts

Let’s go through each principle one by one:
S - Single responsibility principle
O - Open/closed principle
L - Liskov substitution principle
I - Interface segregation principle
D - Dependency inversion principle