How ay2425s2-cs2103t-t14-1/tp works
Project Type & Purpose
• This project is a desktop application built using Java (with JavaFX for GUI), which implements an address book for extended families called “WhoAreYouAgain?”.
• Its main aim is to help users manage and remember family members’ details, events, and other pertinent information.
• The project is a variant of the popular AddressBook-Level3 pattern with clearly separated concerns such as UI, logic, model, storage, and configuration.
File Structure & Architectural Patterns
• Notice the clear separation in the src/main/java directory. There are distinct packages for:
• UI (user interface components, FXML views in src/main/resources/view)
• Logic (command parsing, command execution, and message handling)
• Model (data representation for persons, address book, user preferences, and other domain models)
• Storage (classes handling file I/O and JSON serialization of the address book data)
• Commons/Utilities (miscellaneous utilities, configuration management, and logging)
• The Gradle build files and tests in src/test further attest to the clean separation of concerns and use of dependency management and unit testing.
Main Components and Their Interactions
• UI Layer:
• Comprises classes in the “ui” package and FXML resources defining the layout.
• Handles user inputs and displays results. For example, MainWindow, CommandBox, and other panels.
• Logic Layer:
• Processes user commands through the “logic” package.
• Contains parser components (e.g., AddCommandParser, AddressBookParser) and command classes (e.g., AddCommand, DeleteCommand).
• Converts UI events into business logic execution.
• Model Layer:
• Contains domain classes representing persons, address data, and other family details.
• Includes the address book itself, user preferences, and validation classes.
• Storage Layer:
• Responsible for loading and saving data in JSON (see classes like JsonAddressBookStorage and JsonUserPrefsStorage).
• Abstracts file I/O, ensuring that the Model can persist and retrieve data.
• Configuration & Utilities:
• Provides configuration management, logging, and utility functions that are used across the system.
• These components ensure consistency and easier management of cross-cutting concerns.
Relationships and Data Flow
• The Logic Manager then parses these through the relevant Parser and then decides the correct Command to execute.
• The Command interacts with the Model to update the application state (adding, deleting, editing family member records).
• The updated Model is then saved to or loaded from persistent storage via the Storage Manager.
• Finally, the UI is updated to reflect the changes, closing the feedback loop.
Important Architectural Patterns & Design Principles
• MVC/MVP Concepts:
• Clearly separate concerns between data (Model), user interaction (View/UI), and control logic.
• Command Pattern:
• Commands are encapsulated as separate classes (e.g., AddCommand, EditCommand) to decouple the command logic.
• Layered Architecture:
• Distinct layers (UI, Logic, Model, Storage) interact via well-defined interfaces, making the system modular and testable.
• Unit Testing:
• The test directories illustrate a systematic approach for ensuring each component works as intended.
Essential Elements
• Clear Labels: Mark each component distinctly by naming (e.g., “MainWindow”, “LogicManager”, “ModelManager”, “StorageManager”).
• Annotations: Add notes on key patterns (MVC, Command Pattern) and mention important technologies (Java, JavaFX, Gradle).
Summary:
• The layered architecture (UI, Logic, Model, Storage).
• The flow from user input to command parsing, model update, data persistence, and UI refresh.
• The overall modularity and clean separation of concerns facilitated by patterns like MVC and the Command pattern.