Class diagram for library management system
This class diagram models a simple library management system with five classes: an abstract Person, its subclasses Member and Librarian, and the Book and Loan classes. It is aimed at students learning UML and developers sketching the object model for a small library app.

Example: Class diagram for library management system: click to open it in the editor and change it.
Classes and their members
Each class lists private attributes (marked -) and public methods (marked +). Person is abstract, so it is never created directly. It holds the details shared by everyone in the library.
| Class | Key attributes | Methods |
|---|---|---|
| Person (abstract) | name: String, phone: String | getName(): String |
| Member | memberId: int, maxBooks: int | borrow(book: Book): Loan, returnBook(loan: Loan): void |
| Librarian | staffId: int | addBook(book: Book): void, issueBook(m: Member, b: Book): Loan |
| Book | isbn: String, title: String, available: boolean | isAvailable(): boolean |
| Loan | issueDate: Date, dueDate: Date, fine: double | calculateFine(): double |
Relationships and multiplicity
- Member → Person (inheritance): a Member is a Person and inherits name, phone and getName().
- Librarian → Person (inheritance): a Librarian is also a Person, with an extra staffId.
- Member — Loan (association, 1 to 0..5): one Member can hold zero to five Loans at a time. Each Loan belongs to exactly one Member.
- Loan → Book (directed association, * to 1): each Loan refers to exactly one Book, and a Book can appear in many Loans over time. The arrow means a Loan knows its Book, but a Book does not keep a list of its Loans.
Librarian has no drawn link to Book or Loan. Instead, it works with them through its methods: addBook() takes a Book, and issueBook() takes a Member and a Book and returns a new Loan.
How to adapt it for your project
- Change the 0..5 multiplicity to match your borrowing limit, and keep it in sync with maxBooks.
- Add a returnDate to Loan if fines should depend on the actual return day.
- Split Book into Book and BookCopy if the library owns several copies of one title.
- Add a Reservation class linked to Member and Book if members can place holds.
- Draw explicit associations from Librarian to Loan if you need to record who issued each loan.
Tip: Make sure methods match the relationships. borrow() returns a Loan and calculateFine() lives on Loan, so the fine logic stays next to the dates it needs.
Frequently asked questions
What are the classes in a library management system class diagram?
This diagram has five classes: the abstract Person, Member, Librarian, Book and Loan. Member and Librarian both inherit from Person.
Why is Person an abstract class in the library class diagram?
Person only holds the shared attributes name and phone and the getName() method. The system creates Members and Librarians, never a plain Person, so the class is marked abstract.
How many books can a member borrow in this diagram?
The Member–Loan association has a multiplicity of 0..5, so one member can hold up to five loans at once. The Member class also has a maxBooks attribute that stores this limit.
Make your own class diagram with AI →