Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shehroz4477/solid-design-principles
https://github.com/shehroz4477/solid-design-principles
Last synced: 15 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/shehroz4477/solid-design-principles
- Owner: Shehroz4477
- Created: 2024-02-16T10:12:27.000Z (10 months ago)
- Default Branch: master
- Last Pushed: 2024-02-20T13:50:46.000Z (10 months ago)
- Last Synced: 2024-02-21T04:27:05.656Z (10 months ago)
- Language: C#
- Size: 26.4 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Solid-Design-Principles
The SOLID principles are a set of five design principles in object-oriented programming intended to make software designs more understandable, flexible, and maintainable. Each principle focuses on a specific aspect of software design.## Single Responsibility Principle (SRP):
A class should have only one reason to change, meaning it should have only one responsibility.
By adhering to SRP, classes become more focused, easier to understand, and less prone to unexpected changes.
Separating concerns leads to better maintainability and allows for easier reuse of code.## Open/Closed Principle (OCP):
Software entities (classes, modules, functions, etc.) should be open for extension but closed for modification.
This principle encourages developers to design modules that can be extended without modifying their existing code.
By using techniques such as inheritance, composition, and polymorphism, new functionality can be added without altering existing code.## Liskov Substitution Principle (LSP):
Objects of a superclass should be replaceable with objects of a subclass without affecting the correctness of the program.
In other words, subclasses should be substitutable for their base classes without changing the desirable properties of the program.
Adherence to LSP ensures that derived classes adhere to the contracts established by their base classes, preserving the expected behavior of the program.## Interface Segregation Principle (ISP):
Clients should not be forced to depend on interfaces they don't use.
Instead of creating large, monolithic interfaces, it's better to create smaller, more specific interfaces that are tailored to the needs of clients.
ISP prevents unnecessary dependencies between components and reduces the impact of changes by minimizing the scope of affected code.## Dependency Inversion Principle (DIP):
High-level modules should not depend on low-level modules. Both should depend on abstractions.
Abstractions should not depend on details; details should depend on abstractions.
By decoupling high-level modules from low-level implementation details, DIP promotes flexibility, maintainability, and testability in software systems.
Together, these principles form the SOLID acronym, representing a set of guidelines that help developers create more robust, scalable, and maintainable software designs. Adhering to these principles results in code that is easier to understand, extend, and refactor, ultimately leading to higher-quality software systems.