How openclassrooms-student-center/parkingsystem works
Main Components
• User Interface & Input: In this case, the UI isn’t a web-based GUI but a command line interface (CLI). This is handled by the InteractiveShell class and its supporting utility, InputReaderUtil.
• Application Core/Services: This includes the business logic for handling parking operations, such as ParkingService and FareCalculatorService.
• Data Persistence Layer (DAO): The data access objects, specifically ParkingSpotDAO and TicketDAO, manage interactions with the MySQL database.
• Configuration: The DataBaseConfig class (in the config package) sets up and manages database connections.
• Domain Models: Represented by objects like ParkingSpot, Ticket, and constants defined in packages like constants.
• Testing Components: Although these aren’t part of the running system, unit tests (e.g. FareCalculatorServiceTest, ParkingServiceTest) and integration tests (e.g. ParkingDataBaseIT) are crucial for understanding how the system is validated.
Relationships and Interactions
• The CLI (InteractiveShell) is the entry point (via App.java) and drives application flow by capturing user input.
• Once user actions are received, the UI layer calls the appropriate methods in the service layer (ParkingService, FareCalculatorService) to process business logic.
• The service layer, in turn, uses the DAO layer (ParkingSpotDAO, TicketDAO) to perform CRUD operations on the MySQL DB.
• The DataBaseConfig provides the database connection configuration that integrates the DAO layer with the MySQL server.
• Utility classes (like InputReaderUtil) help in abstracting recurring functions such as reading user input.
• The domain model classes encapsulate the data structures that pass through the various layers.
• The tests (separated into unit and integration) verify the behavior of these components, particularly the interactions between services, DAOs, and the database.
Architectural Patterns and Design Principles
• Layered Architecture (separation of concerns) is in play: the system is loosely partitioned into the presentation (CLI), business logic (services), and data access (DAO) layers.
• Dependency inversion is partly visible where configuration (DataBaseConfig) is injected into the DAO.
Final Advice for the Principal Software Engineer
• Finally, include a minor note on testing which ensures that the design not only covers production code but also highlights available tests indicating the system’s reliability measures.