The Inventory Management System is a console-based application developed in .NET Core. The application allows users to manage their product inventory with functionalities to add, remove, update products, and adjust their inventory quantities.
-
Add Product: Allows the user to add a new product to the inventory. The system auto-generates the product ID to ensure uniqueness.
-
Remove Product: Enables the user to remove a product from the inventory by providing the product ID.
-
Update Product: The user can update an existing product's details like name, description, and price.
-
Adjust Inventory: The inventory quantity for a product can be adjusted, with the current quantity being displayed before adjustment.
-
View Products: Displays a list of all products available and their name, description and price.
-
View Inventory: Displays a list of all products in the inventory along with their quantities.
This application is a demonstration of various OOP concepts:
-
Encapsulation: Each class in the application encapsulates the data it operates on and the methods that manipulate this data. For example,
ProductServiceencapsulates a list of products and provides methods to manipulate this data. -
Inheritance: The system demonstrates inheritance through the use of interfaces which serve as contracts for the classes implementing them.
-
Polymorphism: Polymorphism is used throughout the system where the interfaces are used. For example,
IProductServiceandIInventoryServicecould have multiple implementations.
The DRY principle is followed to avoid duplication of code. For example, the methods to retrieve input from the user (GetStringInput, GetIntInput, GetDecimalInput) are used throughout the system to avoid repeating the same input retrieval and conversion logic.
-
Single Responsibility Principle (SRP): Each class in the system has a single responsibility. For example,
ProductServiceis responsible for managing products, andInventoryServiceis responsible for managing the inventory. -
Open-Closed Principle (OCP): The system is open for extension but closed for modification. New types of products or inventory services could be added without altering the existing code, by implementing the
IProductServiceandIInventoryServiceinterfaces. -
Liskov Substitution Principle (LSP): This is ensured by the use of interfaces. Any class implementing
IProductServiceorIInventoryServicecan be substituted in without the system behaving any differently. -
Interface Segregation Principle (ISP): The system uses two small, specific interfaces (
IProductServiceandIInventoryService) rather than one large, general interface. -
Dependency Inversion Principle (DIP): High-level modules (like
InventoryManager) depend on abstractions (likeIProductServiceandIInventoryService), not on the details of low-level modules. This is demonstrated by the use of constructor injection to provide theProductServiceandInventoryServicedependencies toInventoryManager.
To run this application, you'll need .NET Core SDK installed on your computer. Once installed, you can run the application by using the dotnet run command in the project directory.
By demonstrating usage of OOP principles, SOLID, and the DRY principle, this application provides a solid foundation for a scalable, maintainable application, impressing upon the code's clarity, extensibility, and organization.