Skip to content

MauricioSuporte/SOLID

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 

Repository files navigation

SOLID Principles Examples - C# Project

This repository contains examples demonstrating the SOLID principles in a C# project. Each principle (S, O, L, I, and D) is demonstrated with a simple right and wrong use case. Additionally, you can explore the code to see a correct and incorrect usage as a straightforward example.

Inspiration

This repository is inspired by the SOLID repository created by EduardoPires. You can find the original repository here. It provides a comprehensive collection of SOLID principle examples in C#.

Getting Started

To run the examples, follow the steps below:

  1. Clone the repository: git clone https://github.com/MauricioSuporte/SOLID.git
  2. Open the solution in your preferred IDE.
  3. Build the solution to ensure all dependencies are resolved.
  4. Run the program.

Usage

Upon running the program, a menu with five options will appear. Each option corresponds to a specific SOLID principle and executes a code snippet showcasing a simple correct usage example.

Single Responsibility Principle (SRP)

Option 1: Demonstrates a class with a single responsibility, adhering to the SRP.

Open/Closed Principle (OCP)

Option 2: Illustrates a class that follows the OCP, allowing for extension without modification.

Liskov Substitution Principle (LSP)

Option 3: Shows a correct implementation of the LSP, where subclasses can be used interchangeably with the superclass.

Interface Segregation Principle (ISP)

Option 4: Presents an example of adhering to the ISP by having interfaces specific to the clients needs.

Dependency Inversion Principle (DIP)

Option 5: Highlights the correct usage of the DIP by depending on abstractions rather than concrete implementations.

Choose an option from the menu to explore the examples and learn more about each SOLID principle.

Conclusion

By understanding and applying the SOLID principles, developers can create maintainable, extensible, and testable code. This repository provides examples of correct and incorrect usage of the SOLID principles, helping developers grasp the concepts and apply them effectively in their projects.

Feel free to explore the examples provided and learn from them!

About

Demonstration of use SOLID

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages