A full-featured Java library management system with CLI and GUI, built using OOP principles.
This project is a Java-based interactive library management system developed using object-oriented programming principles.
It provides both a command-line interface (CLI) and a graphical user interface (GUI) to manage books, patrons, and loans. The system simulates real-world library operations including borrowing, returning, renewing books, and maintaining persistent data storage.
- Add, view, and manage books and patrons
- Borrow, return, and renew books
- Loan tracking with due dates
- Loan history per patron
- Soft delete for books and patrons (data preserved)
- Borrowing limit enforcement
- Command-based architecture
- GUI using Java Swing
- Persistent storage using text files
- Unit testing with JUnit
.
├── src
│ ├── commands # Command logic (operations)
│ ├── data # Data persistence and management
│ ├── gui # GUI components (Swing)
│ ├── main # Entry point and parser
│ ├── model # Core entities (Book, Patron, Loan)
│ └── test # Unit tests
│
├── resources
│ └── data
│ ├── books.txt
│ ├── patrons.txt
│ └── loans.txt
│
├── lib
│ ├── junit-4.13.2.jar
│ └── hamcrest-core-1.3.jar
│
├── docs
│ └── demo.png
│
└── README_lib.md
CLI / GUI
↓
Command Layer (commands)
↓
Core Model (model)
↓
Data Layer (data)
↓
File Storage (resources/data)
- The system loads existing data from text files at startup
- User interacts via CLI or GUI
- Commands are parsed and executed
- Changes are applied to the in-memory model
- Data is saved immediately after successful operations
- If saving fails, the system rolls back to the last valid state
Requirements:
- Java 17+
- IntelliJ IDEA
Steps:
- Open the project in IntelliJ
- Mark src as Sources Root
- Add lib/ as project dependency
- Run:
main.Main
- JUnit 4.13.2
- Hamcrest Core 1.3
- Data is stored in resources/data/
- System supports rollback if file saving fails
- Designed to be modular and extendable
- Sepehr Kalantari Soltanieh
- Seyed Atta Rahimi
