How thanghoang54/rental-property-management-system works
Main Components
• User Interface:
• Represented by the ManagerUI.java component, which handles the text-based user interactions.
• Business Logic & Controllers:
• ModelManager and its implementation (ModelManagerImp.java) manage the data retrieval and business rules surrounding the different entities.
• RentalAgreementManager (with RentalManager and its implementation) specifically handles operations related to rental agreements, such as addition, deletion, and update.
• The Build or Builder component may be used for constructing RentalAgreement objects in a controlled manner.
• Data Management:
• FileManager and DataPersistence classes indicate that the system uses file-based persistence (CSV files) to store and retrieve data.
• The CSV files located in the src/data folder represent the persistent storage for various models (Tenant, Host, Owner, Payment, Properties, RentalAgreement).
• Report Generation:
• A dedicated SaveReport submodule is responsible for generating and exporting reports as CSV files after processing.
• Domain Models:
• The model directory contains the classes for the core entities (e.g., CommercialProperty, ResidentialProperty, Tenant, Owner, Host, Payment, RentalAgreement, and Person) that are central to the business logic.
• Utilities:
• Helper classes in src/util (Input.java, ValidateInput.java) assist with user input and validation across the application.
Relationships and Interactions
• The UI layer (ManagerUI) collects user commands and input, then passes these to the appropriate controller (ModelManager or RentalAgreementManager) based on the task (e.g., view, add, update, delete).
• The controller components encapsulate business logic by:
• Interacting with the FileManager to load and persist data stored as CSV files.
• Handling object creation using the builder pattern from the Build module.
• Mediating between the UI and the underlying domain models.
• The domain model classes form the core data structures that are manipulated by both the business logic and persistence layers.
• Data flows from:
• CSV files in the “src/data” directory → to FileManager → to Business Controllers → then, optionally, to the user via ManagerUI, or to reports via the SaveReport module.
• Report generation at the end of the application flow takes the processed or filtered models and writes them out as CSV files into the SaveReport folder.
Important Architectural Patterns and Design Principles
• Separation of Concerns:
• The application clearly separates the user interface, business logic, data persistence, and domain models into distinct modules.
• Layered Architecture:
• UI, business logic (controllers and managers), and data management (persistence and file access) layers communicate in a clear, sequential manner.
• Use of the Builder Pattern:
• The presence of a Builder (e.g., BuilderRentalAgreement.java) indicates an effort to manage object creation in a flexible and standardized way.
• File-based Persistence: