A simple Library Management System with the following features:
- Add books to the library.
- Borrow books from the library.
- Return borrowed books.
- View a list of all available books.
This project focuses on clean, maintainable code while adhering to Test-Driven Development (TDD) principles, SOLID principles and clean code practices.
- Java 17 or later
- JUnit 5
- Maven 3.6.3 or later
- Clone the repository.
- Navigate to the root directory.
- Use the CLI class
LibraryManagementSystemCLIto run the library management system. - Follow menu-driven options for interacting with the system.
- Option 1 : Execute
mvn clean test - Option 2 : Import Run all tests with coverage configuration in your IDE and run the tests.
- Wrote failing test cases before implementing any functionality.
- Incrementally developed the system while ensuring all tests pass.
- Refactored for clean code and maintainability after passing tests.
-
Factory Pattern
- The
LibraryRepositoryFactorydynamically creates repository instances based on the provided repository type (e.g., IN_MEMORY, DATABASE, FILESYSTEM).
- The
-
Singleton Pattern
- The
LibraryRepositoryFactoryis implemented as a singleton to ensure consistent access to a single factory instance throughout the application.
- The
-
Dependency Injection
- The
LibraryServiceImpluses constructor-based dependency injection to decouple service logic from repository creation.
- The
- SOLID Principles.
- Clean Code Practices.
