You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Decompose the monolithic 'reservation.java' class into multiple,
more focused classes to adhere to the Single Responsibility Principle (SRP).
This refactoring aims to improve modularity, testability, and
maintainability of the codebase.
Key changes include:
- **Feat: Introduce Passenger entity class**
Created `Passenger.java` to encapsulate all data related to a single
passenger (e.g., number, name, age, phone, ticket class). This
replaces the multiple parallel arrays previously used.
- **Feat: Implement TicketService for business logic**
Created `TicketService.java` to handle all core business logic
concerning ticket operations. This includes:
- Ticket booking and availability checks.
- Ticket cancellation and refund calculations.
- Passenger search functionality.
- Management of ticket counts per class.
- **Feat: Develop ConsoleUI for user interaction**
Created `ConsoleUI.java` to manage all console-based input and output.
This class is now solely responsible for:
- Displaying menus and application headings.
- Gathering user input for various operations.
- Presenting information, results, and error messages to the user.
- **Feat: Create ReservationApplication for orchestration**
Introduced `ReservationApplication.java` to act as the main
application driver. It initializes and coordinates the `ConsoleUI`
and `TicketService` components, and manages the main application loop
and control flow.
- **Refactor: Remove original 'reservation.java' class**
The responsibilities of the old `reservation.java` class have been
distributed among the new classes, making it obsolete.
This restructuring leads to a more organized codebase where each class
has a clear and single purpose, making future development and
maintenance significantly easier.
0 commit comments