How mahi-rathod/library-management-system-cli works
Main Components
• Presentation/UI Layer: Represented by the “ui” package (Main.java) which handles user interactions.
• Business Logic/Service Layer: The “service” package (Library.java) contains the core logic for managing library operations.
• Data Access Layer (DAO): Located in the “dao” package with BookDAO.java, MemberDAO.java, and DatabaseUtil.java to handle JDBC operations.
• Data Models: In the “model” package, with Book.java and LibraryMember.java defining the schema for books and members.
• Database: An external MySQL database that stores tables (“books”, “members”, “borrowed_books”) as defined in the README.
Relationships and Data Flow
• The UI layer triggers operations by calling methods on the Service layer.
• The Service layer processes business rules and then delegates data-related operations to the DAO layer.
• The DAO layer interacts via JDBC with the MySQL database using the connection provided by DatabaseUtil.
• The Data Models form the data objects that are passed amongst these layers.
Architectural Patterns and Design Principles
• Separation of Concerns: Distinct packages for UI, service, DAO, and model promote modularity.
• Layered Architecture: Clear segregation that makes it easy to change one part (e.g., swapping the database) without affecting the others.
• Use of JDBC for database connectivity indicates a straightforward persistence mechanism without an ORM layer.