Loading...
Learn Design Library System — a key concept for LLD interviews.
You're building a library management system for a city library with 50,000 books. Here's the catch — the library may own 5 copies of the same book. "Clean Code" by Robert Martin is one book, but there are 5 physical copies. How do you model this?
// Book = metadata about a title
class Book {
isbn: string
title: string
author: string
subject: string
publishDate: Date
}
// BookItem = one physical copy of a Book
class BookItem {
barcode: string
book: Book
status: BookStatus
rack: RackLocation
dueDate: Date | null
borrower: Member | null
}
enum BookStatus {
AVAILABLE, CHECKED_OUT, RESERVED, LOST
}How should you separate the concept of a book from its physical copies?