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
.The CalendarViewPanel
component,
CalendarFX
library.ObservableList<Appointment>
in the Model
component, automatically updating the calendar display when appointments are added, removed, or modified.CalendarView
every 10 seconds.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,2")
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)API : Storage.java
The Storage
component,
AddressBookStorage
, AppointmentStorage
, and UserPrefStorage
, allowing it to be treated as any of these types when only specific functionality is needed.Model
component, as its role is to save and 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 undo mechanism is facilitated by Command
and LogicManager
. LogicManager
stores previously executed commands using a CommandHistory
object. Command
has the following operation:
Command#undo()
— To be overridden by commands that we determine to be action commands.Given below is an example usage scenario and how the undo mechanism behaves at each step.
Step 1. The user launches the application for the first time.
Step 2. The user executes delete 5
command to delete the 5th person in the address book. The delete
command gets stored in CommandHistory
object in LogicManager
.
Note: If a command fails its execution, it will not be added to the CommandHistory
object in LogicManager
to be saved as a past command.
Step 3. The user now decides that deleting the person was a mistake, and decides to undo that action by executing the undo
command. The undo
command will extract the latest command excluding undo
and call the undo()
of the latest command.
Note: If there is no past command to undo, an error message will be thrown to the user that this is the case rather than attempting to perform the undo.
The following sequence diagram shows how an undo operation goes through the Logic
component:
The following activity diagram summarizes what happens when a user executes a new command:
The data archiving feature allows users to mark contacts as archived rather than permanently deleting them. Archiving can be used to manage inactive or unneeded contacts without losing historical information or requiring deletion, which is irreversible after the app has been exited or closed.
The archiving feature is implemented using the ArchiveCommand
class, which uses a boolean flag shouldArchive
to handle both archiving and unarchiving actions. Instead of directly modifying the Person
object, which is immutable,
a new Person
instance is created with the updated archive status.
Target user profile:
Value proposition: streamlines the process of social workers contacting and assisting people
Priorities: High (must have) - * * *
, Medium (nice to have) - * *
, Low (unlikely to have) - *
Priority | As a … | I can … | So that I can… |
---|---|---|---|
* * * | new user | view the help manual | familiarise myself with the functionalities of the app. |
* * * | social worker | add information of different people | keep track of people requiring assistance in one place. |
* * * | social worker | view the information of different people I have added | retrieve their information more quickly. |
* * * | social worker | delete the information of people | remove the data of people that I no longer need to keep track of. |
* * * | social worker | edit a person's information | keep their information up-to-date for future use. |
* * | social worker | tag a person | identify and manage people according to their needs. |
* * | social worker | filter through the list of people | navigate the persons list more efficiently. |
* * | social worker | sort people | view people in a more suitable order. |
* * | social worker | compile important personal details | quickly disseminate information to these people. |
* * | social worker | archive people that no longer need assistance | keep my contact list focused on active cases. |
* * | social worker | see the overall statistics for people | better determine the progress I have or need to make. |
* * | social worker | schedule appointments I have with these people | view all my appointments in one place. |
* * | social worker | determine which schemes a person is eligible for | help this person apply for said schemes. |
(For all use cases below, the System is the SocialBook
and the Actor is the user
, unless specified otherwise)
Use case: UC01 - Add new person
MSS:
User enters the command to add a person with their specified details.
SocialBook adds the person and displays the newly added person with the rest of the unarchived people.
Use case ends.
Extensions:
1a. SocialBook detects missing or invalid input.
1a1. SocialBook displays an error message that suggests what a correct input should look like.
1a2. User corrects the input and enters the command again.
Steps 1a1-1a2 are repeated until the user enters a correct input.
Use case resumes from step 2.
1b. SocialBook detects a duplicate person entry.
1b1. SocialBook displays an error message indicating such a person already exists.
1b2. User corrects the input and enters the command again.
Steps 1b1-1b2 are repeated until the user enters a correct input.
Use case resumes from step 2.
Use case: UC02 - View information of all people
MSS:
User enters the command to view all people.
SocialBook displays all people currently stored and their information.
Use case ends.
Use case: UC03 - Delete information of different people
MSS:
User indicates people they want to delete.
SocialBook removes these people’s details from the display.
Use case ends.
Extensions:
1a. SocialBook detects missing or invalid input.
1a1. SocialBook informs user that the input is invalid.
1a2. User corrects the input and enters the command again.
Steps 1a1-1a2 are repeated until the user enters a correct input.
Use case resumes from step 2.
1b. User chooses to delete more than 1 person at a time.
1b1. SocialBook deletes the specified persons.
Use case ends.
Use case: UC04 - Display help window
MSS:
User keys in command to open help manual.
SocialBook displays help manual.
User closes help manual.
Use case ends.
Extensions:
1a. User chooses help manual for specific command.
1a1. SocialBook displays detailed instructions for that command.
Use case ends.
Use case: UC05 - Edit existing information of a person
MSS:
User indicates what to edit for the specified information fields and for whom.
SocialBook updates the fields for that person with user's input.
Use case ends.
Extensions:
1a. SocialBook detects an error in the entered data.
1a1. SocialBook should not update any fields.
1a2. SocialBook displays errors encountered with respect to the field.
1a3. User corrects the input and enters the command again.
Steps 1a1-1a3 are repeated until the user enters a correct input.
Use case resumes from step 2.
Use case: UC06 - Check eligibility for schemes
MSS:
User chooses which person to check eligibility for schemes.
SocialBook displays which schemes the person is eligible for.
Use case ends.
Extensions:
1a. SocialBook detects missing or invalid input.
1a1. SocialBook informs user that the input is invalid.
1a2. User corrects the input and enters the command again.
Steps 1a1-1a2 are repeated until the user enters a correct input.
Use case resumes from step 2.
Use case: UC07 - Add a scheme to a person
MSS
User checks what schemes a person is eligible for (UC06).
User selects a scheme to add to the person.
SocialBook adds the scheme to the person and displays the updated information.
Use case ends.
Extensions:
2a. SocialBook detects missing or invalid input.
2a1. SocialBook informs user that the input is invalid.
2a2. User corrects the input and enters the command again.
Steps 2a1-2a2 are repeated until the user enters a correct input.
Use case resumes from step 3.
2b. The scheme is already added to the person.
2b1. SocialBook informs user that the scheme is already added to the person.
Use case ends.
Use case: UC08 - View what schemes a person is under
User chooses which person to check.
SocialBook displays what schemes the person is currently under.
Use case ends.
Extensions:
1a. SocialBook detects missing or invalid input.
1a1. SocialBook informs user that the input is invalid.
1a2. User corrects the input and enters the command again.
Steps 1a1-1a2 are repeated until the user enters a correct input.
Use case resumes from step 2.
Use case: UC09 - Delete schemes from a person
MSS
User checks what schemes a person is under (UC08).
User selects a scheme to delete from the person.
SocialBook deletes the scheme from the person and displays the updated information.
Use case ends.
Extensions:
2a. SocialBook detects missing or invalid input.
2a1. SocialBook informs user that the input is invalid.
2a2. User corrects the input and enters the command again.
Steps 2a1-2a2 are repeated until the user enters a correct input.
Use case resumes from step 3.
2b. User chooses to delete more than 1 scheme at a time.
2b1. SocialBook deletes the schemes from the person and displays the updated information.
Use case ends.
17
or above installed.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
java -jar socialbook.jar
.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.
Shutting down app
exit
as the input or click the x at the top of app.
Expected: App stops and closes.Deleting a person while all persons are being shown
Prerequisites: List all persons using the list all/
command. Ensure there are multiple persons in this list.
Test case: delete 1,2
Expected: First and second person is deleted from the list. Names of the deleted people shown in the display message.
Test case: delete 1,1,1,2
Expected: First and second person is deleted from the list. Names of the deleted people shown in the display message.
Test case: delete 0
Expected: No person is deleted. Error details about invalid format shown in the display message.
Test case: delete 1,10000
Expected: No person is deleted. Error details about invalid index shown in the display message.
Test case: delete
Expected: No person is deleted. Error details about invalid format shown in the display message.
Adding a scheme to the specified person in the list
Prerequisites: List current persons using the list
command. Ensure there are multiple persons in this list. Specified person must be eligible for at least one scheme. Schemes that the person is eligible for can be checked using scheme INDEX
where index is the person's index.
Test case: addscheme 1 i/1
Expected: The first scheme in the list of schemes the first person is eligible for will be added to that person. Name of the person and added scheme shown in the display message.
Test case: addscheme 0 i/0
Expected: No scheme is added to person. Error details about invalid format shown in the display message.
Test case: addscheme 1
Expected: No scheme is added to person. Error details about invalid format shown in the display message.
Test case: addscheme
Expected: No scheme is added to person. Error details about invalid format shown in the display message.
Deleting schemes from the specified person in the list
Prerequisites: List current persons using the list
command. Ensure there are multiple persons in this list. Specified person must have at least two schemes added to them. Schemes that the person is eligible for can be checked using scheme INDEX
where index is the person's index.
Test case: deletescheme 1 i/1
Expected: The first scheme in the list of schemes the first person has added to them will be deleted. Name of the person and deleted scheme shown in the display message.
Test case: deletescheme 1 i/1,2
Expected: The first and second scheme in the list of schemes the first person has added to them will be deleted. Name of the person and deleted schemes shown in the display message.
Test case: deletescheme 0 i/0
Expected: No scheme is deleted from person. Error details about invalid format shown in the display message.
Test case: deletescheme 1
Expected: No scheme is deleted from person. Error details about invalid format shown in the display message.
Test case: deletescheme
Expected: No scheme is deleted from person. Error details about invalid format shown in the display message.
Adding appointment to the specified person in the list
Prerequisites: List current persons using the list
command. Ensure there are multiple persons in this list. Ensure date and time of appointment you are adding does not conflict with any existing appointments.
Test case: addappt 1 date/2024-11-15 from/16:00 to/18:00
Expected: An appointment with the first person at that date and time period is added to the appointment list. Name of the person and appointment's date and time period shown in the display message.
Test case: addappt 0 date/2024-11-15 from/16:00 to/18:00
Expected: No appointment added to person. Error details about invalid index shown in the display message.
Test case: addappt 1 date/15 Nov 2024 from/16:00 to/18:00
Expected: No appointment added to person. Error details about invalid date format shown in the display message.
Test case: addappt 1 date/2024-11-15 from/16:00 to/10:00
Expected: No appointment added to person. Error details about invalid time period shown in the display message.
Test case: addappt 1 date/2024-11-15
Expected: No appointment added to person. Error details about invalid format shown in the display message.
Test case: addappt 1 from/16:00 to/18:00
Expected: No appointment added to person. Error details about invalid format shown in the display message.
Test case: addappt
Expected: No appointment added to person. Error details about invalid format shown in the display message.
Deleting an appointment in the appointment list
Prerequisites: List appointment list using the listappt
command. Ensure there are multiple appointments in this list.
Test case: deleteappt 1
Expected: The first appointment in the appointment list is deleted. Name of the person the deleted appointment belonged to and that appointment's date and time period are shown in the display message.
Test case: deleteappt 0
Expected: No appointment deleted. Error details about invalid format shown in the display message.
Test case: deleteappt
Expected: No appointment deleted. Error details about invalid format shown in the display message.
Archiving a person while all current (i.e. not archived) persons are being shown
Prerequisites: List current persons using the list
command. Ensure there are multiple persons in this list.
Test case: archive 1
Expected: First person is archived from the list. Name of the archived person shown in the display message.
Test case: archive 0
Expected: No person is archived. Error details about invalid format shown in the display message.
Test case: archive john
Expected: No person is archived. Error details about invalid format shown in the display message.
Test case: archive
Expected: No person is archived. Error details about invalid format shown in the display message.
Archiving an already archived person
Prerequisites: List archived persons using the list archive/
command. Ensure there are multiple persons in this list.
Test case: archive 1
Expected: No change in the list. Error message is displayed indicating that the person is already archived.
Unarchiving a person while all archived persons are being shown
Prerequisites: List archived persons using the list archive/
command. Ensure there are multiple persons in this list.
Test case: unarchive 1
Expected: First person is unarchived from the list. Name of the archived person shown in the display message.
Test case: unarchive 0
Expected: No person is unarchived. Error details about invalid format shown in the display message.
Test case: unarchive john
Expected: No person is unarchived. Error details about invalid format shown in the display message.
Test case: unarchive
Expected: No person is unarchived. Error details about invalid format shown in the display message.
Unarchiving a current person
Prerequisites: List current persons using the list
command. Ensure there are multiple persons in this list.
Test case: unarchive 1
Expected: No change in the list. Error message is displayed indicating that the person is currently not archived.
All data is saved in two files: socialbook.json
for person data and appointments.json
for appointment data.
data
folder.add
, list
, editappt
), the data is saved automatically to the respective files.Dealing with missing data files:
data
folder (in the same location as socialbook.jar
) and delete either socialbook.json
or appointments.json
(or both).socialbook.json
is missing, the app will repopulate with sample data for persons only. Appointments will not be repopulated, and the app will continue with an empty appointment list.appointments.json
is missing, the app will continue to run with an empty appointment list.socialbook.json
and appointments.json
are missing, the app will repopulate with sample data for persons only, while appointments will remain empty.Dealing with corrupted data entries:
socialbook.json
or appointments.json
in the data
folder and change a compulsory field to an invalid value (e.g., set a phone number to -1
).socialbook.json
will clear both person and appointment data.appointments.json
will clear only the appointment data.Team Size: 5
addappt
command, so that users can add them in one step to save time and effort.list
works. For example, to view archived people, you can currently do list archive/
. listappt
can be modified to follow this implementation too.scheme
command, so that the details are mentioned together with the results of which schemes a person is eligible for.statistics
command results in all statistics being displayed but to view all the results, the user has to scroll through, which can cause some minor inconvenience.