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 seed feature seeds dummy data into SocialBook. In the event that the user clears all the contacts in SocialBook, the user can execute the seed command to seed sample data into the SocialBook and continue trying out its features.
The seed command works just like any other Command
object and how a Command
object communicates with the Model
is explained in the Logic component.
The seed command adds a Person
object, in SampleDataUtil
to the Model
, if the Person
object is not already inside SocialBook.
The following activity diagram summarises what happens when a user executes the seed command:
The view feature toggles the card status of a contact in SocialBook to either show all of their information or an abridged version of it.
The view command works just like any other Command
object and how a Command
object communicates with the Model
is explained in the Logic component.
The activity diagram below shows how a view command toggles the card status of a contact:
The visit history feature allows users to save a record of visits to contacts with optional remarks. This allows social workers to better keep track of their interactions with beneficiaries.
The Model component would be altered such that each person would now store a visit history object:
It is optional to include a remark when adding a visit to the visit history. Given this implementation the person's date of last visit can be obtained from visit history.
The emergency contact was designed to only be a phone number in the current implementation. It is intended to extend this so that the emergency contact includes a name and phone number.
A current contact can be assigned as another person's emergency contact. It is also possible to create a person who is only an emergency contact. To generalize we create a class called contactable person which has all the necessary methods and values for an emergency contact:
A person will then store a ContactablePerson as their emergency contact.
Target user profile:
Value proposition: the address book acts as an easy way to locate/contact families and keep track of how long it has been since their last visit.
Priorities: High (must have) - * * *
, Medium (nice to have) - * *
, Low (unlikely to have) - *
Priority | As a … | I want to … | So that I can… |
---|---|---|---|
* * * | social worker | delete a contact | remove the contact when I no longer serve them so that the contact list does not get too long |
* * * | social worker/new user | add contact with phone number | remember the person I serve |
* * * | social worker/new user | add address | easily look up without needed to look up database/files |
* * * | social worker | view my list of contacts | see the beneficiaries I serve |
* * | overwhelmed with many households | take note of how long it has been since I visited each house | ensure that no house gets forgotten in my scheduling |
* * | new user learning the interface | check out basic commands that are frequently used with a help command | learn the basic usage of the program more quickly |
* * | user with multiple contacts per household | tag multiple users to be from the same household | simplify the process of contacting other household members |
* * | social worker | prioritize contacts | allow myself to be able to prioritise household with special needs |
* * | social worker | add alternative contact method | add a contact for elderly who do not have a phone |
* * | social worker/expert user | look for emergency contact quickly | inform next-of-kin when something happen |
* * | social worker/expert user | add family contact | know how many people in the household |
* * | social worker/expert user | add notes | remember if I need to take precaution before visiting the person/family or preparations i need to make |
* * | social worker/expert user | sort contacts by lexicographical order | find contact quickly if I remember the name |
* * | social worker/expert user | search through contacts using keywords | find contact quickly based on key words within the contact information |
* * | social worker/expert user | add alternative phone number | have another way of reaching the beneficiary |
* * | social worker/new user | edit contact | edit the contact without the need to delete and create a new one |
* * | forgetful individual | add tags which explain what service the person needs | remember and be able to meet the needs of beneficiaries |
* * | holder of sensitive information | lock the SocialBook behind a password | avoid having unsolicited sharing of personal information |
* * | max/expert user | add the medicinal information of beneficiaries | to know when to follow up on critical medicines |
* * | new user | see a sample of the product features on display | so that I know how a feature can be used to maximise the value |
* | has rotating beneficiaries | remove several contacts at once, when beneficiaries no longer require care | so that I can make space for new beneficiaries and not keep track of old ones |
* | max/expert user | know the households I need to visit on a certain day | so that I can schedule my day and not forget to visit any households |
* | user short on time | visit households that are geographically close in the same day/visit | minimise the travelling time for myself |
* | user switching devices | transfer the SocialBook contacts from one device to another | avoid having to manually re-enter all the current contacts |
* | max/expert user | export all contacts to a txt file/excel file | so that I have a copy of all beneficiaries, past and present, in a larger database |
* | max/expert user | record social media credentials of a contact, if they have any | so that I can get to know their lives better and establish a closer bond |
* | max/expert user | send reminder to my email a day before my visit | so that I will not forget to visit a household |
* | max/expert user | upload pictures of my beneficiaries | so that I will not forget how they look like |
* | max/expert user | view contacts on google maps | so that I can directly see where and how to go to the household |
* | visual rememberer | add photos for each contact | to match beneficiary names to their faces more easily |
* | loyal user | save contact information into a shareable form | share contacts with colleagues as need be |
* | experienced social worker | locate a link where I can share my views and suggestions on the app | help the app be more user centered and helpful over time |
* | efficient person | create visit paths based on proximity of beneficiaries | to be able to serve the most beneficiaries a day |
* | social person | add notes of on conversations with beneficiaries | develop stronger relationships by building rapport |
(For all use cases below, the System is the SocialBook
and the Actor is the user
, unless specified otherwise)
MSS
User requests to list contacts
SocialBook shows a list of contacts
Use case ends.
Extensions
2a. The list is empty.
Use case ends.
2b. The given list command has extraneous parameters.
2b1. SocialBook shows an error message.
Use case ends.
MSS
User requests to add a contact into the list with the specified details
SocialBook adds the contact and displays the newly added contact
Use case ends.
Extensions
2a. The given specified details is empty.
2a1. SocialBook shows an error message.
Use case ends.
2b. The given name and phone number is detected as duplicate.
2b1. SocialBook shows an error message.
Use case ends.
2c. There is an error in any of the specified details.
2c1. SocialBook shows an error message.
Use case ends.
MSS
User requests to list contacts
SocialBook shows the list of all contacts
User requests to view all the information of a specific contact in the list
SocialBook displays the requested information to the user
Use case ends.
Extensions
2a. There are no contacts available.
Use case ends.
3a. The given index is non-numerical.
3a1. SocialBook shows an error message.
Use case resumes at step 2.
3b. The given index is out of bounds.
3b1. SocialBook shows an error message.
Use case resumes at step 2.
MSS
User requests to list contacts
SocialBook shows a list of contacts
User requests to delete a specific contact in the list
SocialBook deletes the contact
Use case ends.
Extensions
2a. The list is empty.
Use case ends.
3a. The given index is invalid.
3a1. SocialBook shows an error message.
Use case resumes at step 2.
MSS
2a. The list is empty.
Use case ends.
3a. The given specified field is/are empty.
3a1. SocialBook shows an error message.
Use case resumes at step 2.
3b. The given index is invalid.
3b1. SocialBook shows an error message.
Use case resumes at step 2.
3c. There is an error in any of the specified fields.
3c1. SocialBook shows an error message.
Use case resumes at step 2.
MSS
2a. The list is empty.
Use case ends.
3a. The given specified field is/are empty.
3a1. SocialBook shows an error message.
Use case resumes at step 2.
3b. There is an error in any of the specified fields.
3b1. SocialBook shows an error message.
Use case resumes at step 2.
MSS
2a. The list is empty.
Use case ends.
3a. The given index is invalid.
3a1. SocialBook shows an error message.
Use case resumes at step 2.
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
Download the jar file and copy into an empty folder
Open a command terminal, cd
into the folder you put the jar file in, and use the java -jar socialbook.jar
command to run the application. Expected: Shows the GUI with a set of sample contacts. The window size may not be optimal.
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.
Deleting 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.
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.
Deleting a person while found persons are being shown
Prerequisites: Find people with names matching a particular keyword using the find
command.
Test case: delete x
(where x is less than or equal to the number of found persons)
Expected: Contact x is deleted from the list. Details of the deleted contact shown in the status message.
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.
Deleting persons while all persons are being shown
Prerequisites: List all persons using the list
command. Multiple persons in the list.
Test case: delete 1 2
Expected: First and second contact are deleted from the list. Names of the deleted contacts are shown in the status message.
Test case: delete x y
(where x,y are greater than the number of listed persons)
Expected: No person is deleted. Error details shown in the status message. Status bar remains the same.
Test case: delete 0 1
Expected: First contact is deleted from the list. Name of the deleted contact and invalidity of the index 0 is shown in the status message.
Dealing with missing files
Delete config.json
and re-launch the app.
Expected: New config.json
created. Existing data is not affected.
Delete preferences.json
and re-launch the app.
Expected: New preferences.json
created. Existing data is not affected.
Edit the line "addressBookFilePath" : "data/socialbook.json"
to "addressBookFilePath" : "data/data.json"
and re-launch the app.
Expected: App starts on clean slate (i.e. with sample data only).
Delete data/
or data/socialbook.json
.
Expected: New data/socialbook.json
created. App starts on clean slate (i.e. with sample data only).
Dealing with corrupted data files
Add "p"
to a "phone"
field in data file.
Expected: The person with the "p"
in "phone"
field is lost. The rest of the contacts still exist in the contact list.
Add a new field "newField" : "newField"
to a person.
Expected: The person with the new field is lost. The rest of the contacts still exist in the contact list.
Remove "remark"
field from a person.
Expected: The person with the missing "remark"
field is lost. The rest of the contacts still exist in the contact list.
Add a ","
to the "remark"
field of a person.
Expected: The file data format is invalid. All data is lost. The app starts on clean slate.
Sorting entries while all persons are being shown
Prerequisites: List all persons using the list
command. Multiple persons in the list.
Test case: sort n/asc
Expected: Persons are sorted in ascending order according to ASCII. A message saying the list has been sorted by name in ascending order is displayed.
Test case: sort d/desc
Expected: Persons are sorted in descending order according to date of last visit. Where a person doesn't have a date of last visit they are at the end of the list. A message saying the list has been sorted by date of last visit in descending order is displayed.
Editing a parameter being sorted while all persons are being shown
Prerequisites: List all persons using the list
command. Multiple persons in the list. Sort using sort n/asc
Test case: edit 1 n/"name starting with a different letter"
Expected: A message is displayed showing the information of the updated person. The person moves in the display list according to the position of their new name (given ascending name order).
Test case: add n/hunter p/61234578
Expected: A message is displayed showing the information of the added person. The person is added to the list according to the position of their name (given ascending name order).
For reference, our group has 5 members.
list
command with miscellaneous parameters error message more helpful. Currently, typing list
with miscellaneous parameters, ex. list 123
, will result in a message that states "Please ensure your command is valid!". To improve specificity this will be changed to ask user to remove miscellaneous parameters.or
. This means that searching for the tag "low_income" will bring up all tags containing "low" and "income" instead of just "low_income".remark
command while keeping remark fields. Currently, remarks can be added via the edit command or the remark command but not the add command. Instead of having a dedicated remark
command, we will allow users to use the add
command to create a contact with remarks, or the edit
command to modify the remark of a contact. This change solves an associated issue whereby the remark command currently collapses the detailed view on the contact.domainName
region of the email. Traditionally, emails require at least 2 domain labels separated by a .
, but the current implementation only requires one domain label. Something like johnsmith@yahoo
is accepted as an email address when it should be rejected.edit
command upon attempt to index with 0. The current error message for edit 0 n/Bob
states "invalid command format" when it should mention that the index provided is invalid.remark
command upon attempt to index with 0. The current error message for remark 0 r/Hates frisbees
states "invalid command format" when it should mention that the index provided is invalid.delete
command upon attempt to index with 0. The current error message for delete 0
states "invalid command format" when it should mention that the index provided is invalid.view
command upon attempt to index with 0. The current error message for view 0
states "invalid command format" when it should mention that the index provided is invalid.