Book Catalog

Java | JDBC | SQL | Visual Studio Code

What It Is & Why I Developed It

This project started as a practical way to organize the growing number of books in my home. I wanted a simple, functional tool that was customizable and easy to update. Building it gave me the opportunity to strengthen my skills in Java and JDBC while applying core software development concepts like CRUD operations, user input validation, and database interaction.

How to Use

To use the book catalog, simply run the program and it will open up in the terminal. From there, navigation is done by selecting a number from lists of options, or by selecting Y/N to respond to yes/no prompts. View a video of the program in action here: Video Demo

How I Did It

  1. Set Up The Repository
  2. I created the repository in GitHub and cloned it in VS Code so that I could use GitHub for version control.

  3. Set Up Database
  4. I downloaded the appropriate JDBC driver to allow my Java application to communicate with the database. Next, I created a CreateDatabase utility class that establishes the initial SQLite database file (bookcatalog.db). Running this class ensures the database exists before the application starts. For ongoing database operations, I implemented a DatabaseHelper class responsible for connecting to the database and performing database-related functionalities using methods with prepared SQL statements.

  5. Development
  6. Initially, I was developing everything inside of one big do...while loop, but I soon realized that this was not sustainable or dynamic. Instead, I opted to make every functionality of the program into its own method. The Main Menu is a method, which, based on the user's input, calls other methods. Each method (which I named Create(), Read(), Update(), and Delete() after CRUD operations) contains two do...while loops.

    The first do...while contains an if...else statement to perform tasks based on user input. The second do...while loop handles user continuation. After completing an action (like adding or searching for a book), it asks whether the user wants to perform the task again. If yes, the method is called again. If no, a Return() method is called, to ask the user whether they want to return to the Main Menu. If yes, MainMenu() is called. If no, the terminal prints "Goodbye!" and the program ends.

    I chose to use do...while loops for most of the operations because of how much user input the program requires. Using a do...while loop allows the program to prompt the user for input, take the input to perform functions, and then cease functions when the while condition is met, or re-prompt the user if an invalid input is entered.

What's Next

What I'll Be Adding in the Future

The ability to search for books using keywords. This would allow the user to search for specific topics, sequels to other books, etc. in addition to searching by title, author, etc. the way one is currently able to.