How nhatcoi/oop-hotelms-app works
Main Components
• User Interface (Presentation Layer):
• JavaFX-based GUI, with FXML files and associated CSS (located under src/main/resources/com/mycompany/app/views and css folders).
• Views are split into different modules (e.g., authentication, guest operations, manager operations, admin views).
• Controllers:
• Located under the “controllers” packages (in hotel_management and week5to6) that manage user actions.
• Subdivided controllers such as AuthController, GuestController, ManagerController, and specialized ones for admin tasks.
• Domain/Entity Layer:
• Contains entity classes like Room, Guest, Staff, Reservation, Payment, and Comment.
• Also includes enums (e.g., RoomStatus, RoomType, UserRole) that define various domain-specific properties.
• Service Layer:
• Contains service interfaces (e.g., RoomService, GuestService, StaffService) and implementations.
• This layer contains the core business logic to process room booking, check-in/out, and management operations.
• Repository/Database Access Layer:
• The “repositories” package (with Database.java) handles data persistence.
• Although the README mentions MySQL as the main DB, the actual data persistence can also include file-based binary storage for room information.
• Utilities and Support Modules:
• Utility classes (e.g., MailSender, Security, FilesUtils, Dialog, ToolFXML, Md5, etc.) provide support functions.
• Configuration:
• JSON config files (config-example.json and config.json) and other artifacts (pom.xml) indicate use of Maven for dependency management and setup.
• Additional/Legacy Code:
• There are directories for week-by-week assignments (week1, week2, week3, etc.) that might not be part of the final product but can be mentioned as examples of learning exercises.
Relationships and Interactions
• The UI (JavaFX) sends user interactions (such as login, room booking, etc.) to the corresponding Controller.
• Controllers act as intermediaries by invoking methods in the Service layer.
• The Service layer contains the business rules and logic, accessing the Repository layer to perform CRUD operations on entities.
• The Repository layer interacts with persistent storage (likely MySQL and/or binary files as indicated in the README).
• Utility classes are used across layers for tasks like validation, security (e.g., MD5 hashing), and file operations.
• Configuration files are loaded to set up application parameters (e.g., database connection details).
Architectural Patterns and Design Principles
• MVC or layered architecture:
• Separation of concerns between UI, controller, service, and data access layers.
• Modularity:
• Clearly separated packages and distinct functional areas.
• Reusability and Abstraction:
• Use of interfaces for services to allow for flexible implementations.
• Integration of external libraries/technologies:
• JavaFX for GUI, CSS for styling, MySQL for database operations, Maven for build automation.
Including Relevant Technologies
• Java (core application language)
• JavaFX (for the GUI)
• MySQL (storing customer, room, and booking details)
• CSS (for styling the UI)
• Maven (pom.xml for dependency management)
• External libraries for additional functions (e.g., MailSender, security utilities)
Elements
• Flow of data from the user (UI) to Controllers, then to Services, and finally to the Database.
• Interactions between services and utility classes.