Book Management System

Difficulty: MEDIUMCategory: LLDFrequency: 1Asked On 2021-12-02

Problem Statement

Design and implement a Book Management System that allows users (e.g., library staff, readers, or admins) to manage books, track availability, and perform book-related operations.


Functional Requirements (FR)


Book Management


•Add new books with details (title, author, ISBN, genre, publisher, published date).
•Update book details.
•Remove books from the system.
•Search for books by title, author, genre, or ISBN.


Inventory Management


•Track number of available copies.
•Mark books as available, issued, or reserved.


User Management


•Register/login users (reader, librarian/admin roles).
•Manage profile (name, email, role).


Borrowing/Reservation


•A user can borrow an available book.
•A user can return a borrowed book.
•A user can reserve a book if all copies are issued.


Notifications (Optional)


•Notify when reserved book becomes available.
•Notify when due date for return is near.


Non-Functional Requirements (NFR)


•Scalability: Should handle thousands of books and users.
•Consistency: Book availability status must be accurate at all times.
•Low Latency: Searching and updating books should be fast.
•Security: Role-based access control (admin vs. normal user).


Core Entities & Attributes


•Book → bookId, title, author, genre, ISBN, publisher, publishedDate, copiesAvailable, status
•User → userId, name, email, role (reader/librarian)
•BorrowRecord → recordId, bookId, userId, borrowDate, dueDate, returnDate, status
•Reservation → reservationId, bookId, userId, reservationDate, status


Example Use Case


1.Admin adds "Clean Code" with 3 copies.
2.User searches and borrows 1 copy → available copies = 2.
3.Another user borrows remaining 2 copies → available copies = 0.
4.Third user reserves the book → added to waiting list.
5.When someone returns a copy, system notifies the reserved user.


Evaluation Criteria


•Clean class design (Book, User, BorrowRecord, Reservation, etc.).
•Correct handling of book availability, borrowing, and returning.
•Efficient search implementation.
•Handling edge cases (borrow when unavailable, multiple reservations).


Solution

Comments