How nkduyennn/student-management-system works
Main Components
• Frontend/UI: Represented by the HTML templates (found under src/main/resources/templates) and static resources (CSS files under src/main/resources/static). These pages handle registration, login, and personalized views for students, teachers, and administrators.
• Controller Layer: The controllers under the directory “controller” (e.g., AdminController, LoginController, RegistrationController, StudentController, and TeacherController) use Spring MVC to handle HTTP requests, routing users to the correct views.
• Service Layer: Service interfaces and implementations (e.g., AssignmentService, CourseService, StudentService, TeacherService) encapsulate the business logic.
• Data Access Object (DAO) Layer: DAO interfaces and implementations (e.g., CourseDao, AssignmentDao, etc.) abstract the operations to the underlying persistence store.
• Domain/Entity Models: Represented in the “entity” package; these classes map to tables in the MySQL database.
• Security & Configuration: Components under “config” (like DemoSecurityConfig and CustomAuthenticationSuccessHandler) manage authentication and authorization for the three user roles.
• Database: The system uses MySQL with Hibernate for ORM to persist and query data.
Relationships and Interactions
• Users (students, teachers, and admins) interact with the Frontend (views created with HTML/CSS).
• The web browser sends HTTP/HTTPS requests that are handled by the corresponding Controller based on URL routing.
• Controllers invoke the Service Layer which contains the business logic (e.g., handling enrollment, assignment updates, or statistic retrieval).
• The Service Layer interacts with the DAO Layer for CRUD operations on domain entities.
• The DAO Layer communicates with the underlying MySQL database using Hibernate, ensuring persistence.
• Security configuration components intercept requests to enforce role-based access control.
• Maven is used to maintain dependencies and build the project, while the Dockerfile (present at the root) indicates that containerization might also be part of the deployment strategy.
Architectural Patterns and Design Principles
• Layered Architecture: The clear separation into controllers, services, DAOs, and entity models aligns with the best practices in software engineering.
• MVC Pattern: The project uses Spring MVC to separate the presentation layer from the business logic.
• Role-Based Access Control (RBAC): Security configurations ensure that each type of user has access only to the relevant parts of the system.
• Configuration/Convention Over Configuration: Spring Boot’s auto-configuration and sensible defaults are utilized to simplify setup.
Additional Details
• Since there are multiple packages for controllers, services, and repositories, consider summarizing them into “Controller”, “Service”, and “DAO” components to avoid clutter.