{ list here sources of all reused/adapted ideas, code, documentation, and third-party libraries -- include links to the original source as well }
Refer to the guide Setting up and getting started.
The Architecture Diagram given above explains the high-level design of the App.
Given below is a quick overview of main components and how they interact with each other.
Main components of the architecture
Main (consisting of classes Main and MainApp) is in charge of the app launch and shut down.
The bulk of the app's work is done by the following four components:
UI: The UI of the App.Logic: The command executor.Model: Holds the data of the App in memory.Storage: Reads data from, and writes data to, the hard disk.Commons represents a collection of classes used by multiple other components.
How the architecture components interact with each other
The Sequence Diagram below shows how the components interact with each other for the scenario where the user issues the command delete 1.
Each of the four main components (also shown in the diagram above),
interface with the same name as the Component.{Component Name}Manager class (which follows the corresponding API interface mentioned in the previous point.For example, the Logic component defines its API in the Logic.java interface and implements its functionality using the LogicManager.java class which follows the Logic interface. Other components interact with a given component through its interface rather than the concrete class (reason: to prevent outside component's being coupled to the implementation of a component), as illustrated in the (partial) class diagram below.
The sections below give more details of each component.
The API of this component is specified in Ui.java
The UI consists of a MainWindow that is made up of parts e.g.CommandBox, ResultDisplay, PersonListPanel, StatusBarFooter etc. All these, including the MainWindow, inherit from the abstract UiPart class which captures the commonalities between classes that represent parts of the visible GUI.
The UI component uses the JavaFx UI framework. The layout of these UI parts are defined in matching .fxml files that are in the src/main/resources/view folder. For example, the layout of the MainWindow is specified in MainWindow.fxml
The UI component,
Logic component.Model data so that the UI can be updated with the modified data.Logic component, because the UI relies on the Logic to execute commands.Model component, as it displays Person object residing in the Model.API : Logic.java
Here's a (partial) class diagram of the Logic component:
The sequence diagram below illustrates the interactions within the Logic component, taking execute("delete 1") API call as an example.
Note: The lifeline for DeleteCommandParser should end at the destroy marker (X) but due to a limitation of PlantUML, the lifeline continues till the end of diagram.
How the Logic component works:
Logic is called upon to execute a command, it is passed to an AddressBookParser object which in turn creates a parser that matches the command (e.g., DeleteCommandParser) and uses it to parse the command.Command object (more precisely, an object of one of its subclasses e.g., DeleteCommand) which is executed by the LogicManager.Model when it is executed (e.g. to delete a person).Model) to achieve.CommandResult object which is returned back from Logic.Here are the other classes in Logic (omitted from the class diagram above) that are used for parsing a user command:
How the parsing works:
AddressBookParser class creates an XYZCommandParser (XYZ is a placeholder for the specific command name e.g., AddCommandParser) which uses the other classes shown above to parse the user command and create a XYZCommand object (e.g., AddCommand) which the AddressBookParser returns back as a Command object.XYZCommandParser classes (e.g., AddCommandParser, DeleteCommandParser, ...) inherit from the Parser interface so that they can be treated similarly where possible e.g, during testing.API : Model.java
The Model component,
Person objects (which are contained in a UniquePersonList object).Person objects (e.g., results of a search query) as a separate filtered list which is exposed to outsiders as an unmodifiable ObservableList<Person> that can be 'observed' e.g. the UI can be bound to this list so that the UI automatically updates when the data in the list change.UserPref object that represents the user’s preferences. This is exposed to the outside as a ReadOnlyUserPref objects.Model represents data entities of the domain, they should make sense on their own without depending on other components)Note: An alternative (arguably, a more OOP) model is given below. It has a Tag list in the AddressBook, which Person references. This allows AddressBook to only require one Tag object per unique tag, instead of each Person needing their own Tag objects.

API : Storage.java
The Storage component,
AddressBookStorage and UserPrefStorage, which means it can be treated as either one (if only the functionality of only one is needed).Model component (because the Storage component's job is to save/retrieve objects that belong to the Model)Classes used by multiple components are in the seedu.address.commons package.
This section describes some noteworthy details on how certain features are implemented.
The proposed undo/redo mechanism is facilitated by VersionedAddressBook. It extends AddressBook with an undo/redo history, stored internally as an addressBookStateList and currentStatePointer. Additionally, it implements the following operations:
VersionedAddressBook#commit() — Saves the current address book state in its history.VersionedAddressBook#undo() — Restores the previous address book state from its history.VersionedAddressBook#redo() — Restores a previously undone address book state from its history.These operations are exposed in the Model interface as Model#commitAddressBook(), Model#undoAddressBook() and Model#redoAddressBook() respectively.
Given below is an example usage scenario and how the undo/redo mechanism behaves at each step.
Step 1. The user launches the application for the first time. The VersionedAddressBook will be initialized with the initial address book state, and the currentStatePointer pointing to that single address book state.
Step 2. The user executes delete 5 command to delete the 5th person in the address book. The delete command calls Model#commitAddressBook(), causing the modified state of the address book after the delete 5 command executes to be saved in the addressBookStateList, and the currentStatePointer is shifted to the newly inserted address book state.
Step 3. The user executes add n/David … to add a new person. The add command also calls Model#commitAddressBook(), causing another modified address book state to be saved into the addressBookStateList.
Note: If a command fails its execution, it will not call Model#commitAddressBook(), so the address book state will not be saved into the addressBookStateList.
Step 4. The user now decides that adding the person was a mistake, and decides to undo that action by executing the undo command. The undo command will call Model#undoAddressBook(), which will shift the currentStatePointer once to the left, pointing it to the previous address book state, and restores the address book to that state.
Note: If the currentStatePointer is at index 0, pointing to the initial AddressBook state, then there are no previous AddressBook states to restore. The undo command uses Model#canUndoAddressBook() to check if this is the case. If so, it will return an error to the user rather
than attempting to perform the undo.
The following sequence diagram shows how an undo operation goes through the Logic component:
Note: The lifeline for UndoCommand should end at the destroy marker (X) but due to a limitation of PlantUML, the lifeline reaches the end of diagram.
Similarly, how an undo operation goes through the Model component is shown below:
The redo command does the opposite — it calls Model#redoAddressBook(), which shifts the currentStatePointer once to the right, pointing to the previously undone state, and restores the address book to that state.
Note: If the currentStatePointer is at index addressBookStateList.size() - 1, pointing to the latest address book state, then there are no undone AddressBook states to restore. The redo command uses Model#canRedoAddressBook() to check if this is the case. If so, it will return an error to the user rather than attempting to perform the redo.
Step 5. The user then decides to execute the command list. Commands that do not modify the address book, such as list, will usually not call Model#commitAddressBook(), Model#undoAddressBook() or Model#redoAddressBook(). Thus, the addressBookStateList remains unchanged.
Step 6. The user executes clear, which calls Model#commitAddressBook(). Since the currentStatePointer is not pointing at the end of the addressBookStateList, all address book states after the currentStatePointer will be purged. Reason: It no longer makes sense to redo the add n/David … command. This is the behavior that most modern desktop applications follow.
The following activity diagram summarizes what happens when a user executes a new command:
Aspect: How undo & redo executes:
Alternative 1 (current choice): Saves the entire address book.
Alternative 2: Individual command knows how to undo/redo by itself.
delete, just save the person being deleted).{more aspects and alternatives to be added}
{Explain here how the data archiving feature will be implemented}
Target user profile:
Value proposition: Provides a centralized system for personal trainers to efficiently manage client contact details, track injury histories, and monitor training goals and skill progress, optimized for users who prefer a fast, keyboard-driven interface.
Priorities: High (must have) - * * *, Medium (nice to have) - * *, Low (unlikely to have) - *
| Priority | As a … | I want to … | So that I can… |
|---|---|---|---|
* * * | trainer | add a client with their personal particulars | create a basic contact record for a new client |
* * * | trainer | find a client by searching for their name | quickly access a specific person's profile |
* * * | trainer | delete a specific client record | remove clients who are no longer training with me |
* * * | trainer | list all clients currently in the system | see an overview of my entire client base |
* * * | trainer | view a client's injury history | plan a safe workout before the session starts |
* * | trainer | record a trainee's weekly training timeslot | efficiently plan my training schedule in advance |
* * * | trainer | save my client data | never lose my client data |
* * * | trainer | update a client's contact details | maintain accurate contact information |
* * * | new user | launch the app via the command line | start managing my data quickly |
* * * | trainer | record a new injury for a client | keep their health profile up to date |
* * * | trainer | set an initial training level (e.g., Beginner) | know where to start a new client's training workout |
* * * | trainer | filter the list by training level | plan group sessions for similar abilities |
* | impatient user | get search results in under 200ms | not feel held up while on the gym floor |
* * * | trainer | undo the last command executed | quickly fix accidental deletions or edits |
* | trainer | list all clients who have no recorded injuries | identify clients who can handle high-intensity workouts |
* | expert user | use short aliases (e.g., a for add) | enter data faster during back-to-back sessions |
* | trainer | edit an existing progress note | correct typos or add more detail later |
* | trainer | clear the screen with a command | keep my terminal interface tidy and focused |
* | expert user | perform multi-parameter searches | find beginners with back injuries more specifically |
* | expert user | export a summary report of all clients | review my monthly coaching impact offline |
(For all use cases below, the Actor is the Trainer and the System is the PTCoach, unless specified otherwise)
Use case: UC1 - Add a client
MSS
Trainer requests to add a client.
PTCoach shows a success message.
Use case ends.
Extensions
1a. The given details are invalid.
1a1. PTCoach shows an error message.
Use case ends.
1b. The given client exists.
1b1. PTCoach shows an error message.
Use case ends.
1c. The given command has an incorrect format.
1c1. PTCoach shows an error message.
Use case ends.
Use case: UC2 - Find a specific client
MSS
User requests to find a specific clients.
PTCoach shows list of all clients that match the person(s).
Use case ends.
Extensions
1a. Trainer searches for an invalid name.
1a1. PTCoach shows an error message.
Use case ends.
1b. The given command has an incorrect format.
1b1. PTCoach shows an error message.
Use case ends.
2a. The list is empty.
Use case ends.
Use case: UC3 - Edit a client
MSS
Trainer requests to edit a specific client.
PTCoach shows a success message.
Use case ends.
Extensions
1a. Invalid index
1a1. PTCoach shows an error message.
Use case ends.
1b. Has missing parameters
1b1. PTCoach shows an error message.
Use case ends.
1c. No changes found
1c1. PTCoach shows a success message.
Use case ends.
1d. Incorrect format.
1d1. PTCoach shows an error message.
Use case ends.
Use case: UC4 - Delete a client
MSS
User requests to delete a specific client by index.
PTCoach deletes the client.
PTCoach shows a success message confirming the deletion.
Use case ends
Extensions
1a. The list is empty.
1a1. PTCoach shows an error message.
Use case ends.
1b. The client does not exist.
1b1. PTCoach shows an error message.
Use case ends.
1c. The given command is in an incorrect format.
1c1. PTCoach shows an error message.
Use case ends.
Use case: UC5 - Launch the app via command line
MSS
User requests to launch the app via command line.
PTCoach launches.
Use case ends.
Extensions
1a. The given command is in an incorrect format.
Use case ends.
Use case: UC6 - List all clients
MSS
Trainer requests to view clients (optionally filtered by skill).
PTCoach shows a list of all clients.
PTCoach shows a list of clients matching the request.
Use case ends.
Extensions
1a. The given command is in an incorrect format.
1a1. PTCoach shows an error message.
Use case ends.
2a. The list is empty.
2a1. PTCoach shows a message indicating that the list is empty.
Use case ends.
3a. No clients match the filter.
3a1. PTCoach shows an empty list.
Use case ends.
3b. Missing filter parameter
3b1. PTCoach shows a message indicating that the parameter is empty.
Use case ends.
Use case: UC7 - Read client details
MSS
Trainer requests to view a client’s details.
PTCoach displays the requested client data.
Use case ends
Extensions
1a. The given details are invalid.
1a1. PTCoach shows an error message.
Use case ends.
1b. Client does not exist
1b1. PTCoach shows an error message.
Use case ends
1c. Trainer enters incorrect command format.
1c1. PTCoach shows an error message.
Use case ends.
Use case: UC8 - Navigate command history
MSS
Trainer presses the Up or Down arrow key.
PTCoach displays the corresponding command from the command history.
Use case ends.
Extensions
1a. There are no previously entered commands.
Use case ends.
1b. Trainer presses Up when already at the oldest command.
Use case ends.
1c. Trainer presses Down when already at the most recent command.
Use case ends.
{More to be added}
{More to be added}
Personal Particulars: The set of information stored for each client, including:
* Optional particulars
Field: A property of a person stored in the system
Client: The person being added into the address book
Trainer: The user of the program
Duplicate clients: 2 Clients with the same phone number
Timeslot: A field in a client which represents the timeslot allocated for training by the trainer
{More to be added}
Given below are instructions to test the app manually.
Note: These instructions only provide a starting point for testers to work on; testers are expected to do more exploratory testing.
Initial launch
Download the jar file and copy into an empty folder
Double-click the jar file Expected: Shows the GUI with a set of sample contacts. The window size may not be optimum.
Saving window preferences
Resize the window to an optimum size. Move the window to a different location. Close the window.
Re-launch the app by double-clicking the jar file.
Expected: The most recent window size and location is retained.
Exiting the application
Test Case: exit
Expected: The application closes.
Click on the exit icon of the application Expected: The application closes.
Adding a person with all compulsory fields
Prerequisites: The application is running normally.
Test case: add n/John Doe p/98765432 e/johnd@example.com a/John street, block 123, #01-01 t/Run 50km ts/mon:1,2
Expected: A new person is added to the list. A success message is shown.
Adding a person with all fields
add n/John Doe p/98765432 e/johnd@example.com a/John street, block 123, #01-01 t/Run 50km ts/mon:1,2 i/Shoulder dislocation s/beginner pr/50Adding a duplicate person
Prerequisites: A person with phone number 98765432 already exists.
Test case: add n/Jane Doe p/98765432 e/janed@example.com a/Jane street t/Lift 100kg ts/tue:3
Expected: No person is added. An error message is shown.
Adding a person with invalid fields
Test case: add n/John Doe p/abc123 e/johnd@example.com a/John street t/Run 50km ts/mon:1,2
Expected: No person is added. An error message is shown because the phone number is invalid
Test case: add n/John Doe p/98765432 e/invalidEmail a/John street t/Run 50km ts/mon:1,2
Expected: No person is added. An error message is shown because the email is invalid
Test case: add n/John Doe p/98765432 e/johnd@example.com a/John street t/Run 50km ts/mon:13
Expected: No person is added. An error message is shown because the timeslot is invalid
Adding a person with missing compulsory fields
Test case: add n/John Doe p/98765432 e/johnd@example.com a/John street t/Run 50km
Expected: No person is added. An error message is shown because the timeslot is missing.
Test case: add n/John Doe p/98765432 e/johnd@example.com a/John street ts/mon:1,2
Expected: No person is added. An error message is shown because the training goal is missing.
Listing all persons
listListing persons by skill filter
Prerequisites: There are persons with different skill levels in the list.
Test case: list s/beginner
Expected: Only persons with skill level Beginner are shown.
Test case: list s/expert
Expected: Only persons with skill level Expert are shown.
Test case: list s/beginner s/intermediate
Expected: Only persons with skill level Beginner and Intermediate are shown.
Listing persons with no matching filter
list s/beginner when there are no beginner clientsListing persons with invalid filter
Test case: list s/advanced
Expected: The command is accepted but no client has the skill level Advanced. Hence, an empty list is shown.
Test case: list s/beginer
Expected: The command is accepted but no client has the skill level beginer. Hence, an empty list is shown. (note the beginer here has a typo error)
Listing persons with missing filter parameter
list s/
Expected: An error message is shown because the skill filter is blank.Editing a person with one field
Prerequisites: List all persons using the list command. At least one person exists.
Test case: edit 1 p/91234567
Expected: The phone number of the 1st person is updated. A success message is shown.
Editing a person with multiple fields
edit 1 e/johndoe@example.com t/Lift 100kg ts/fri:2,3 pr/70 s/intermediateEditing a person with invalid index
Prerequisites: List all persons using the list command. There is at least one person in the list and fewer than 999 persons in the list.
Note: The index refers to the position shown in the displayed list and starts from 1.
Test case: edit 0 p/91234567
Expected: No person is edited. An error message is shown because index starts with 1 not 0.
Test case: edit 999 p/91234567
Expected: No person is edited. An error message is shown because index is out of range.
Editing a person with invalid values
Test case: edit 1 p/abc123
Expected: No person is edited. An error message is shown because phone number is invalid.
Test case: edit 1 ts/mon:13
Expected: No person is edited. An error message is shown because Timeslot is invalid.
Test case: edit 1 s/advanced
Expected: No person is edited. An error message is shown because skill is invalid.
Editing a person without providing fields
edit 1Deleting a person while all persons are being shown
Prerequisites: List all persons using the list command. Multiple persons in the list.
Test case: delete 1
Expected: First contact is deleted from the list. Details of the deleted contact shown in the status message. Timestamp in the status bar is updated.
Test case: delete 0
Expected: No person is deleted. Error details shown in the status message. Status bar remains the same.
Other incorrect delete commands to try: delete, delete x, ... (where x is larger than the list size)
Expected: Similar to previous.
Clearing the address book
Prerequisites: List all persons using the list command. There are multiple persons in the address book.
Test case: clear
Expected: All persons are removed from the list. A success message is shown.
Clearing an already empty address book
Prerequisites: The address book is empty.
Test case: clear
Expected: The list remains empty. A success message is shown.
Opening the help window
helpHelp with extra parameters
help abcNavigating to previous commands
Prerequisites: Enter several commands such as list, find John, and help.
Press the Up arrow key once.
Expected: The most recently entered command is shown in the command box.
Press the Up arrow key again.
Expected: The next earlier command is shown in the command box.
Navigating to newer commands
Prerequisites: Use the Up arrow key at least once to move into command history.
Press the Down arrow key once.
Expected: A more recent command is shown in the command box.
Navigating when there is no command history
Prerequisites: Fresh launch of the app without entering any command.
Press the Up arrow key.
Expected: No command is shown. The command box remains empty.
Navigating beyond the oldest command
Prerequisites: There are previously entered commands.
Repeatedly press the Up arrow key until the oldest command is shown.
Press the Up arrow key again.
Expected: The oldest command remains shown.
Navigating beyond the most recent command
Prerequisites: Use the Up arrow key to navigate through command history.
Repeatedly press the Down arrow key until the most recent position is reached.
Press the Down arrow key again.
Expected: The command box becomes empty.
Saving data after add/edit/delete/clear
Perform an add, edit, delete, or clear command.
Close the application.
Re-launch the application.
Expected: The changes made previously are still present.
Dealing with missing data file
Prerequisites: The data file [JAR file location]/data/addressbook.json does not exist.
Launch the application.
Expected: The application starts successfully with an empty list.
Dealing with corrupted data file
Prerequisites: The data file [JAR file location]/data/addressbook.json contains invalid JSON.
Launch the application.
Expected: The application loads an empty list.