How dinhnguyenhd/swing-jdbc works
Main components
• GUI (Presentation Layer): Represented by files in the "GUI" folder (e.g., ViewAction.java). This layer is responsible for user interaction using Java Swing.
• BUS (Business Logic Layer): Found in the "BUS" folder (e.g., TableAction.java). This layer contains the core business rules and operations that coordinate between the GUI and DAO.
• DAO (Data Access Layer): Located in the "DAO" folder with files such as DaoAction.java and SQLConnection.java. This layer manages all database interactions using JDBC.
• Entity (Domain Model): Contains domain classes like Students.java. These represent the data entities used by the business layer.
• Database: While not a code component, "students.sql" indicates the schema or SQL commands for setting up the relational database which the DAO interacts with.
Relationships and interactions
• The GUI layer (Swing interface) captures user input and sends requests to the Business layer.
• The Business layer processes requests, applies business rules, and makes calls to the DAO layer to perform CRUD operations.
• The DAO layer manages the database connections and data retrieval/insertion based on the business logic.
• The Entity layer acts as the data model throughout this process, ensuring that data is consistently structured between application and database.
• Additionally, the database, represented via the SQL script, is the persistent store that supports the DAO.
Architectural patterns and design principles
• 3-Layered Architecture: Clear separation into Presentation (GUI), Business (BUS), and Data Access (DAO) ensures modularity and easier maintenance.
• MVC principles: Although this is a desktop application, the separation of concerns mirrors the MVC pattern, where the GUI serves as the view (and controller responsibilities), the BUS is analogous to the model’s business logic, and the DAO manages data persistence.
• Loose coupling between layers achieved by ensuring each layer knows as little as necessary about the others.
Relevant technologies, frameworks, and libraries
• Java Swing for the graphical user interface.
• JDBC for database connectivity.
• Eclipse project structure (noted by the .project and .settings directories) which suggests using the Eclipse IDE to manage the project.
• SQL for database schema definition and operations (via students.sql).
Elements
• Clear labels for each component (GUI, BUS, DAO, Entity, Database).