How jasonma1127/library-manage-system works
Project type and purpose
• This is a standalone Java desktop application (“Library-Manage-System”) built using Java Swing for its GUI and MySQL as its persistent store.
• Its purpose is to let users register, log in, view/search/borrow/return book items, and for an admin to add new book items. Development follows Test-Driven Development (TDD).
File structure
• Top-level:
• Dump20210610.sql – database schema dump
• LibraryManageSystem/lib – third-party JAR (mysql-connector-java)
• LibraryManageSystem/bin – compiled classes, mirroring src packages
• LibraryManageSystem/src – Java source, split into packages:
– dataType: domain models (BookItem, UserInfo, Status)
– development: GUI.java (presentation), jdbcConnection.java (data access), ButtonColumn.java (helper)
– testing: unit tests exercising all user flows (login, register, search, borrow, return, etc.)
• Configuration: jdbcConnection.java contains JDBC URL/credentials.
• Build/deploy: running GUI.java launches the app; AllTests.java runs the TDD suite.
README insights
• Emphasizes TDD; all core behaviors are covered by unit tests in testing/.
• Workflow: GUI <-> JDBC <-> MySQL.
• User scenarios documented with screenshots.
Main components
a. Presentation Layer (Java Swing GUI)
• GUI.java, ButtonColumn.java
• Handles user interactions (register, login, view/search, borrow/return, add book)
b. Domain Model (Data Types)
• BookItem, UserInfo, Status
• Shared by presentation and data access layers
c. Data Access Layer (JDBC Connector)
• jdbcConnection.java
• Manages SQL connections/queries against MySQL
d. Database
• MySQL schema loaded from Dump20210610.sql
• Tables: users, book_items, borrow_records (implied)
e. Test Harness
• AllTests.java and individual test classes in testing/
• Invokes domain logic and data access methods to validate behavior
f. External Library
• mysql-connector-java-8.0.24.jar in lib/
• Shown as an external dependency
Relationships and interactions
• UI layer calls methods on Data Access Layer to read/write data.
• Data Access Layer maps result sets to Domain Model objects and vice versa.
• Domain Model flows between UI and DAL.
• Tests bypass the UI (where appropriate) to directly exercise DAL/domain methods.
• JDBC driver acts as the intermediary between the Java app and MySQL server.
Architectural patterns & design principles
• Layered architecture (Presentation → Business/Domain → Data Access → Database)
• Separation of concerns: UI, domain types, persistence, tests clearly separated into packages.
• TDD: each feature is backed by a unit test class.
Essential details to capture
• Source-folder separation (dataType vs. development vs. testing)
• The external MySQL connector JAR and the SQL dump as deployment artifacts
• The bidirectional flow between the Java app and the database
• The TDD feedback loop (unit tests driving development of domain & DAL)