2. The reason behind most unsuccessful
applications
Putting more stress on classes by assigning more responsibilities to them. (A lot of
functionality not related to a class.)
Forcing the classes to depend on each other. If classes are dependent on each
other (in other words tightly coupled), then a change in one will affect the other.
Spreading duplicate code in the system/application.
3. Solution
Choosing the correct architecture (in other words MVC, micro service ,3-tier,
Layered, MVP, MVVP and so on).
Following Design Principles.
Choosing correct Design Patterns to build the software based on its
specifications.
5. History
The term SOLID is an acronym for five design principles intended to make
software designs more understandable, flexible and maintainable.
The principles are a subset of many principles promoted by Robert C. Martin
The SOLID acronym was first introduced by Michael Feathers.
6. S — Single responsibility principle
"Every software module should have only one reason to
change“
This means that every class, or similar structure, in your
code should have only one job to do. Everything in that
class should be related to a single purpose.
Small is good
9. O — Open/closed principle
The Open/closed Principle says "A software module/class is
open for extension and closed for modification“
"Open for extension" means, we need to design our
module/class in such a way that the new functionality can be
added only when new requirements are generated.
"Closed for modification" means we have already developed
a class and it has gone through unit testing. We should then
not alter it until we find bugs. As it says, a class should be
open for extensions, we can use inheritance to do this.
13. L — Liskov substitution principle
"you should be able to use any derived class instead of
a parent class and have it behave in the same manner
without modification“
This principle is just an extension of the Open Close
Principle and it means that we must ensure that new
derived classes extend the base classes without changing
their behavior.
15. I — Interface segregation principle
"that clients should not be forced to implement
interfaces they don't use. Instead of one fat interface
many small interfaces are preferred based on groups of
methods, each one serving one sub module.“
Do not add additional functionality to an existing
interface by adding new methods.
Instead, create a new interface and let your class
implement multiple interfaces if needed.
19. D: Dependency Inversion Principle
The Dependency Inversion Principle (DIP) states that high-level
modules/classes should not depend on low-level modules/classes.
Both should depend upon abstractions
Secondly, abstractions should not depend upon details. Details
should depend upon abstractions.
is a way to decouple software modules.
dependency inversion pattern, most often solved by using
dependency injection.
Adapter Design Pattern use DIP
21. If don’t use SOLID Principles
End up with strong coupling of the code with other modules
End up with a code which is not testable
End up with duplication of code
Fix a bug with create another bug
22. Following SOLID Principles …
Achieve reduction in complicity of code
Increase readability, extensibility and maintenance
Reduce error and implement Reusability
Achieve better testability
Reduce tight coupling
23. Conclusion
These are 5 essential principles used by professional software engineers all around the
globe, and if you are serious about creating ‘solid’ software, you should start applying
these principles today!