This repository contains a C# console application showcasing good and bad coding practices, emphasizing SOLID principles. The project is divided into two parts:
Explore LINQ queries applied to a collection of books. The examples cover different scenarios, showcasing the power and flexibility of LINQ in querying and manipulating data.
- Navigate to the
LINQPractice
folder. - Open
Program.cs
in your preferred C# development environment (e.g., Visual Studio). - Build and run the application.
The HowToNotCode Project is designed to demonstrate both good and bad coding practices within a book management system. The components include:
BookRepository.cs
: Implements the book repository.BookService.cs
: Implements the book service with good and bad coding examples.ExceptionHandler.cs
: Provides a centralized approach to exception handling.Book.cs
: Defines the Book class.
-
Dependency Inversion Principle (DIP):
BookService
utilizes the DIP by injecting an interface (IBookRepository) for the bookRepository dependency.
-
Single Responsibility Principle (SRP):
- Methods in
BookService
adhere to SRP, handling specific tasks such as adding, updating, deleting books, and viewing books and authors.
- Methods in
-
Clean Error Handling:
- The code demonstrates clean error handling practices, providing informative messages for invalid input.
The BookService
class includes both good and bad examples, allowing developers to compare and understand the impact of applying SOLID principles.
- Navigate to the
HowToNotCode
folder. - Open
Program.cs
in your preferred C# development environment. - Build and run the
HowToNotCode
project.