This repository contains Python code examples that demonstrate violations of the SOLID principles in software development. Each principle violation is showcased with code samples, highlighting the consequences and potential issues that arise when these principles are not adhered to.
Example code showcasing situations where a class or module takes on multiple responsibilities, leading to potential code entanglement and difficulties in maintenance.
Code snippets illustrating how failure to design for extension while being closed for modification can result in brittle and hard-to-maintain systems.
Demonstrations of violations where subclasses are unable to substitute their parent class, causing unexpected behavior or breaking the program's assumptions.
Instances highlighting issues stemming from interfaces that are too broad, leading to unnecessary dependencies and coupling between components.
Code examples depicting scenarios where high-level modules depend on low-level modules directly, rather than relying on abstractions, resulting in inflexible codebases.
The repository is organized into folders corresponding to each SOLID principle. Within each folder, you'll find:
- Code Examples: Python scripts illustrating violations of the specific principle.
- README.md: Detailed explanations of the principle, its importance, and the showcased violations.
You can explore each principle's folder to understand the violations and their implications. Each example is accompanied by comments and explanations to provide clarity.
Feel free to clone or download the repository to examine the code locally.
Contributions are welcome! If you have more examples or improvements to the existing code that highlight violations of SOLID principles, feel free to open a pull request.
For a deeper understanding of SOLID principles and their importance in software development, refer to the following resources:
- SOLID Principles - Wikipedia
- Clean Code: A Handbook of Agile Software Craftsmanship by Robert C. Martin
This repository is licensed under the MIT License.