SOLID foundation manifesto, each class must only have one responsibility.
Liskov Substiotion Principle
Interface Segregation Principle
Dependency inversion Principle
SOLID principle will help you to improve readability, somehow we face some difficulties when code review or read existing code that people wrote, even you got bugfix with legacy code. when you try to fix it, it triggers another side effect. SOLID Principle comes to rescue this case.
Debugging will always be one process that software engineers did, Developer should able to understand the code flow when debugging, for existing code that already implement if there no design pattern, this becomes a time-consuming process. take a long time to understand what those codes work. For future improvement or bug fix, if developer wants to make any changes sometime will break another function because if couple tied with main function, developer should be careful to do this cos it might create another bug.
We can't rely on people that work before us so it better we prepare it first, due to some factors that they cant bring documentation. if documentation already available could be out of sync. so documentation should be updated together with development running.
Based above problem, we search solution, one of that is a design pattern, many design pattern that can obtain and integrate, but it should suitable with our environment. For example, you using react so you can use Redux. Why design pattern contribute crucial role,
- Every class and module only focus on one purpose.
- Everything in class must relate to a single purpose.
- Break all single-purpose into small crunch it will become concise.
- Class functionality can be easily extended
- Other functionalities aren’t affected
- The class will be smaller, hence easier to understand
- Easy to identify a problem and fix it on time
- If a new team is working on the code, it’s easier since it’s well organized.
- Each of the classes may have references to other classes as member fields or method parameters
- The separation of classes makes a relationship of classes more complex. This in turn might result in generation of classes that have too many references to other classes as members