This project is a modular, object-oriented Library Management System built using Java. It follows the SOLID design principles and applies key design patterns such as Strategy, Factory, and Builder. The system supports extensibility, maintainability, and clarity in architecture.
- Book management (add, update, search)
- Patron management (register, update, track borrowing)
- Book checkout and return process
- Multiple borrowing strategies based on patron types (Student, Guest, Faculty)
- Designed using clear service interfaces and model separation
src/
├── BorrowingStrategies/ # Strategy pattern implementations
├── Enums/ # Enum definitions (BookStatus, PatronType)
├── Exceptions/ # Custom exceptions (e.g., MaxBorrowingLimitReached)
├── Interfaces/ # Interfaces for services and strategies
├── Models/ # Domain models (Book, Patron, etc.)
├── Services/ # Implementations of services
└── Main.java # Entry point
Below is a high-level class diagram showing the relationship between core components of the system:
- Interfaces (e.g.,
IBookService,ILendingService) ensure abstraction and decoupling. Patronuses aBorrowingStrategyto decide borrow limits.BorrowingRecordlinks aPatronand aBookCopy.BookCopyreferencesBookMetaInfo.
| Pattern | Purpose |
|---|---|
| Strategy | Implement multiple borrowing rules based on patron type |
| Factory | Create borrowing records based on input context |
| Builder | Build BookCopy safely and with flexible parameters |
-
Clone the repository:
git clone https://github.com/bharat2002/LibraryManagement.git
cd LibraryManagement -
Compile the source code:
javac -d out src/**/*.java
-
Run the application:
java -cp out Main
Library library = new Library();
library.addBook("Effective Java", "Joshua Bloch", "ISBN1234", 2008, 3);
library.registerPatron(...);
library.checkoutBook(...);
This project is licensed under the MIT License.
