Lab 01
Lab 01
Lab-01
Table of Contents
System Requirements
The key requirements that need to be offered by the library management
system can be classified into functional and non-functional requirements.
Functional Requirements
1. Allow the librarian to add and remove new members.
2. Allow the user to search for books based on title, publication date,
author, etc., and find their location in the library.
3. Users can request, reserve, or renew a book.
4. Librarian can add and manage the books.
5. The system should notify the user and librarian about the overdue
books.
6. The system calculates the fine for overdue books on their return.
There are 3 actors in the use case diagram. The User, The Librarian, and
the System.
User - The user can log in, view the catalog, search for books, checkout,
reserve, renew and return a book.
Librarian - The librarian registers new users, adds and maintains the
books, collects fines for overdue books, and issues books to users who
need them.
Accuracy
Availability
The System should be available for the duration when the library operates
and must be recovered within an hour or less if it fails. The system should
respond to the requests within two seconds or less.
Maintainability
The software should be easily maintainable and adding new features and
making changes to the software must be as simple as possible. In addition
to this, the software must also be portable.
Software Requirements
1. A server running Windows Server/Linux OS
2. A multi-threading capable backend language like Java
3. Front-end frameworks like Angular/React/Vue for the client
4. Relational DBMS like MySQL, PostgreSQL, etc
5. Containers and orchestration services like Kubernetes (for a large
setting like a national library).
‘
High Level Design
For a Small Setting (School/College):
In a school or college, The users are usually students and the faculty of the
institution. Hence, the traffic is usually pretty low with an estimated 5,000
concurrent users at the peak. A group of servers each with 16GB of RAM
and a capable processor should be able to handle the load. Each server
may need to handle several requests at a time. The requests can be
queued and a reply can be sent to the user while the request is being
processed.
The user can access the system through a client site or app with a
registered account. The librarian can access the admin dashboard and
interface using the admin account.
These libraries are huge and are available to the general public. Anyone
can visit these libraries. However, they may contain many important
artifacts and rarely allow users to borrow books. The number of concurrent
users can range from 100,000 for a state library to 10 Million for a national
library at its peak.
These systems can also have separate user and admin interfaces for
browsing books and managing users and books respectively.
The servers may be distributed across different regions in the country with
load balancers to distribute the traffic. Proxy servers may be used to cache
the requests and reduce the number of disk reads. Services such as
authentication and notification may be deployed as separate containers.
This allows scaling much more easily and simplifies the addition of new
services.
The database can also be distributed with the regional data such as books
of languages spoken in a region being stored in that region. Many
government libraries preserve physical books in digital form and allow
anyone to read them online without borrowing.
class Person{
String firstName;
String lastName;
String gender;
String Address;
Double phoneNo;
}
class Library{
String name;
String Address;
List <Book> books;
}
The Person class is the base class and contains fields for the basic
information such as name, address, etc. The Member class inherits the
person class and adds fields such as a unique user id, login email, and
password and also methods to login and logout. Both the User and
Librarian classes inherit the Member class. The user can search for a
book and pay a fine. The Librarian can issue books, add, delete or update
books in the library. The Library class contains the name, address of the
library along with the list of available books.
class Book{
int bookId;
String title;
String author;
String category;
Date pubDate;
Location location;
}
class Location{
int shelfNo;
int floorNo;
class Search{
public List<Book> geBookByTitle(String title);
public List<Book> geBookByAuthor(String author);
public List<Book> geBookByCateogry(String bookType);
public List<Book> geBookByPublicationDate(Date publicationDate);
}
class BookIssueService {
public double calculateFine(int days,User user,Book book);
public BookReservationDetail reserveBook(Book book, User user);
public BookIssueDetail issueBook(Book book, User user);
public BookIssueDetail renewBook(Book book, User user);
public void returnBook(Book book, User user);
}
class BookLending {
Book book;
Date startDate;
User user;
}
The Book class contains information about the book like its title, author,
publication date, etc. The Location class is used to represent where the
book is present in the library.
The Search class allows the user to search for books using various
methods like author, title, category, publication date. The
BookIssueService class has methods to handle reserve books, issue
books, renew a book, and return a book. It also calculates the fine for
overdue books.
The above image shows one possible database schema for the library
management system.
The users table stores the user details such as a unique user id, name,
contact, and login information. The admin table references the user id as a
foreign key and stores the role of the admin such as Librarian, Assistant,
etc.
The details about the books are stored in the books table. It includes the
book title, author, publisher, date of publication, category, etc. The
category table contains more details about each of the categories that may
help the reader. The shelf table contains the location of the book in the
library which may include the shelf number and floor number.
The borrowing table contains the information about the book borrowed
such as the id of the user who borrowed it, the date borrowed, the due
date, etc. This information can be used to calculate the fine for overdue
books. The records table stores every return made so that it can be
referenced when needed. It also stores the fine amount paid if applicable.