Professional Documents
Culture Documents
SOLID
SOLID
Purposes
+ To make the code more maintainable.
+ To make it easier to extend without breaking/affecting something else that
you've developed earlier.
+ To make the code easier to read and understand thus spending less time for
figuring out what the code does and more time developing the solution.
Principles
1- Single Responsibility Principle
+ A class or a method (basically an entity) should only be responsible for
one thing.
+ Considering method of a controller;
- A controller should only be responsible from the flow.
- You should put input validation, DB modifiers in other methods of
other classes.
2- Open/Closed Principle
+ An entity should be open for extension but closed for modification.
+ Extend the functionality by adding new code instead of changing existing
code.