This project is submitted in partial fulfilment of the Degree of Master of Science in Computer Science.
Endorsement from Dr. Riccardo Polvara: "one of the very best projects I had to mark".
- Project Overview
- Features
- Directory Structure
- Installation Instructions
- Testing
- Usage
- Contributing
- Documentation
- Acknowledgements
- License
This project is a console-based library management system written in C++. It supports adding, removing, and searching for books within a library. The system is designed to be extensible, allowing for the addition of more features such as user management, networking capabilities, and persistence with a database.
This paper presents the design and implementation of a console-based library management system developed in C++. The system encompasses core functionalities such as book and user management, facilitating the addition, removal, and searching of library resources. It incorporates advanced features including borrowing and returning operations, data persistence through a database, multi-threading for efficient concurrency, and networking support for remote access. Additionally, there is potential for future enhancements such as advanced search capabilities, enhanced user management, and improved data visualisation. Through a modular and well-structured architecture, the Library Management System ensures seamless interaction between its components, providing a robust solution for managing library resources effectively.
The full report can be found here.
-
Book Management:
- Add, remove, and search for books in the catalogue.
- Each book is represented as a
Bookclass, managing attributes such as title, author, ISBN, year published, and availability status. - Methods include
getID(),getTitle(),getAuthor(),getISBN(),getYearPublished(),isAvailable(),setTitle(),setAuthor(),setISBN(),setYearPublished(),setIsAvailable(),borrowBook(),returnBook(), andgetInfo().
-
User Management:
- Add, remove, and manage library users.
- Each user is represented as a
Userclass, managing attributes such as username, forename, surname, email, phone number, password, and borrowed books. - Methods include
getID(),getUsername(),getForename(),getSurname(),getEmail(),getPhoneNumber(),getPassword(),getBorrowedBooks(),setUsername(),setForename(),setSurname(),setEmail(),setPhoneNumber(),setPassword(),borrowBook(),returnBook(),checkOutStatus(), andgetInfo().
-
Borrow and Return Books:
- Track which user has borrowed which book and manage the due dates for returns.
- Implement transactions via a
Transactionclass that captures book borrowing and returning details along with timestamps. - Methods include
getID(),getType(),getStatus(),getBook(),getUser(),getDatetime(),setStatus(),setDatetime(),execute(),cancel(), andgetInfo().
-
Networking for Concurrent Remote Access:
- Enable remote access to the library system through a server-client architecture.
- Implement server-side functionality using the
Serverclass and client-side operations using sockets. - The
Serverclass handles client connections, manages threads for concurrent client handling, and communicates with theApplicationclass.
-
Data Persistence with JSON:
- Enable data persistence through the
PersistenceManagerclass which saves and loads data to and from theDatabase. - If there is no data to load,
Databaseis populated with sample data for testing.
- Enable data persistence through the
-
Additional Functionalities:
- Pagination: Implement a method to navigate through long lists of books, users, and transactions efficiently using the
Menuclass. - Approximate Search: Enable search functionality with fuzzy matching using the
Databaseclass.
- Pagination: Implement a method to navigate through long lists of books, users, and transactions efficiently using the
-
Documentation Generation:
- Use Doxygen to generate comprehensive project documentation, detailing classes, methods, and relationships.
Library-Management-System/
├── CMakeLists.txt # CMake build configuration file
├── doc/ # Documentation directory
│ └── Doxyfile # Doxygen configuration file
├── include/ # Header files
│ ├── Application.hpp # Application class header
│ ├── Book.hpp # Book class header
│ ├── Database.hpp # Database class header
│ ├── Library.hpp # LibraryManager class header
│ ├── Menu.hpp # Menu class header
│ ├── Multithreading.hpp # Multithreading utilities header
│ ├── Networking.hpp # Networking utilities header
│ ├── Persistence.hpp # Persistence utilities header
│ ├── Transaction.hpp # Transaction class header
│ ├── User.hpp # User class header
│ └── Utils.hpp # Utility functions header
├── lib/ # Source files
│ ├── Application.cpp # Application class implementation
│ ├── Book.cpp # Book class implementation
│ ├── Database.cpp # Database class implementation
│ ├── Library.cpp # LibraryManager class implementation
│ ├── main.cpp # Main program entry point
│ ├── Menu.cpp # Menu class implementation
│ ├── Multithreading.cpp # Multithreading utilities implementation
│ ├── Networking.cpp # Networking utilities implementation
│ ├── Persistence.cpp # Persistence utilities implementation
│ ├── Transaction.cpp # Transaction class implementation
│ ├── User.cpp # User class implementation
│ └── Utils.cpp # Utility functions implementation
└── tests/ # Test files
├── ApplicationTest.cpp # Application class tests
├── BookTest.cpp # Book class tests
├── DatabaseTest.cpp # Database class tests
├── LibraryTest.cpp # LibraryManager class tests
├── MenuTest.cpp # Menu class tests
├── MultithreadingTest.cpp # Multithreading utilities tests
├── NetworkingTest.cpp # Networking utilities tests
├── PersistenceTest.cpp # Persistence utilities tests
├── TransactionTest.cpp # Transaction class tests
└── UserTest.cpp # User class tests
To install and set up the project locally, follow these steps:
-
Clone the repository:
git clone https://github.com/alfieatkinson/Library-Management-System.git cd Library-Management-System -
Run the build script:
./make.sh
-
Run the server:
./build/LibraryManagementSystem
This project uses CMake for the build and test process. The make.sh script simplifies the build process. To test the project, use one of the following commands:
-
Build the project and run tests:
./make.sh -t
-
Build and run a specific test:
./make.sh -t TestName
Replace TestName with the actual name of the test you want to run.
To use the library management system, follow these steps:
-
Connect a client to the server:
telnet localhost 8080
OR
nc localhost 8080
-
Interact with the system:
- Login: Enter your username and password.
- Register: Create a new user account.
- Borrow Book: Borrow a book from the library.
- Return Book: Return a borrowed book to the library.
- Search Items: Search for books, users, or transactions.
- View My Profile: View your user profile.
- Update My Profile: Update your user profile.
- Add New Book: Add a new book to the library (admin only).
- Add New User: Add a new user to the system (admin only).
We welcome contributions to the Library Management System project. To contribute, follow these steps:
- Fork the repository on GitHub.
- Clone your forked repository:
git clone https://github.com/your-username/Library-Management-System.git cd Library-Management-System - Create a new branch for your feature or bugfix:
git checkout -b feature-or-bugfix-name
- Make your changes and commit them with a descriptive message:
git commit -am 'Add new feature or fix bug' - Push your changes to your forked repository:
git push origin feature-or-bugfix-name
- Create a pull request on the original repository.
Please review our Code of Conduct before contributing.
This project uses Doxygen for generating documentation. If you have Doxygen installed, the LaTeX documentation will be generated in the directory ./docs/latex/.
I would like to thank Dr. Riccardo Polvara for providing excellent teaching in the module which this project is a part of.
I would also like to thank the following third-party libraries/tools used in this project:
- Doxygen for generating documentation.
- Catch2 for unit testing framework.
- Shields.io for providing badges.
This project is licensed under the terms of the MIT License.