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 add
command allows users to add a new contact to the addressbook with required and optional fields.
The command format is as follows:
add n/NAME ct/CONTACT_TYPE [h/TELEGRAM_HANDLE] [p/PHONE_NUMBER] [e/EMAIL] [m/MODULE] [r/REMARK] [t/TAG]…
NAME
, CONTACT_TYPE
, at least one of TELEGRAM_HANDLE
, PHONE_NUMBER
or EMAIL
TELEGRAM_HANDLE
, PHONE_NUMBER
, EMAIL
, MODULE
, REMARK
, TAG
The command parser identifies each prefix (e.g. n/
, ct/
, h/
) and stores the associated data in a new contact.
The optional fields allow users to include more detailed information, making the contact record customizable.
Parser
component processes the add
command string to extract required and optional fields.n/
, ct/
, h/
, etc.) to correctly identify each piece of data and verify that required fields
(NAME
, CONTACT_TYPE
and one of TELEGRAM_HANDLE
, PHONE_NUMBER
, EMAIL
) are present. If any required field is missing,
an error is raised, prompting the user to provide the necessary information.LogicManager#execute()
, which transfers control to the Storage
componentJsonAddressBookStorage#saveAddressBook()
method which calls the JsonSerializableAddressBook
constructor, to create an object that can be serialized in JSON format.The switch
theme command allows users to change the display to "light" mode or "dark" mode according to their preference. The preferred theme will be stored and displayed every time the user opens the app.
The command format is as follows:
switch THEME
THEME
can be either LIGHT
or DARK
Parser
component processes the switch
command string to extract the requested theme ('light' or 'dark'), creating a new SwitchThemeCommand
with the specified theme.ParseException
is raised with an error message, prompting users to enter a valid input.SwitchThemeCommand#execute
calls ThemeController.switchTheme()
to apply the new theme.ThemeController
clears current stylesheets, applies the specified stylesheet and logs the theme change.ThemePreference.setTheme()
, which calls saveThemePreference()
to update the JSON file.ThemePreference
loads the saved theme from themePreference.json
, or defaults to LIGHT
if none is found.SwitchThemeCommand
, users receive immediate confirmation of the theme change, providing clarity and an improved experience.ThemePreference
manages file I/O errors with warnings, defaulting to LIGHT
if any issues arise with loading or saving preferences.The import
command allows users to import multiple contacts from a .csv file. The command allows for convenient distribution and importing of contacts. Contact distributors (e.g. course coordinators) can compile many contacts at a time (e.g. course TAs), with appropriate contact information and distributte them to users.
The command format is as follows:
import
Converter
component processes the .csv
files to convert each file into a .json
file. It first requests all the fields that compose a Person
class. It then reads the .csv
file headers for headers that match these fields (case-insensitive)..csv
file line by line, to parse each line under a valid header into a properly formatted .json
object, which is then added to a jsonFile..csv
file into a .json
file with the same name..csv
files, these individual .json
files are put into an ArrayList
of .json
files and returnedConverterException
is raised with an error message.
.csv
is empty, or invalid, or the Import folder is empty or missingList<File>
that should contain the .json
files to be imported.importAllJsonFiles()
, the importer will loop through each .json
file in the list, parse them, then convert them to AddressBook.class
, and add each .json
file to the model
.phone
, email
, and telegramHandle
require at least one entry, the rest can be left emptyname
or contactType
, these entries will be skipped by the Converter
Target user profile:
Value proposition: University students meet people from many different places (e.g. different classes, CCAs, student accommodation, etc). As such, they often have too many contacts that are hard to keep track of. Thus, we hope to make it easier to categorise and find contacts when they need them.
Priorities: High (must have) - * * *
, Medium (nice to have) - * *
, Low (unlikely to have) - *
Priority | As a … | I want to … | So that I can… |
---|---|---|---|
* * * | new user | easily access usage instructions | refer to instructions when I forget how to use the App |
* * * | student | add new contacts with their details (eg. name, telegram handle, contact type, module) | keep track of my university contacts in the app |
* * * | student | delete a contact | remove entries that I no longer need for university |
* * * | student | find a person by name, telegram handle or tag | locate details of persons without having to go through the entire list |
* * * | student | edit contact details (e.g. phone number, email) | so that I can keep the information of my university contacts up to date |
* * | student | add a new contact with multiple tags (e.g., CCA, classmate) | categorise them based on different associations |
* * | student | categorise contacts into different contact types (eg. work, personal) | organise people according to my needs |
* * | student | be able to filter my contacts based off different contact types | find my contacts faster |
* * | student | tag contacts with multiple categories | find them easily in different contexts |
* * | student | import contacts from csv files | quickly add a large number of contacts without entering them manually |
* | student | receive reminders to reach out to contacts I haven’t communicated with in a while | maintain my connections |
(For all use cases below, the System is UniLink
and the Actor is the user
, unless specified otherwise)
Use case: UC001 - Add a new contact
MSS
User requests to add a new contact
User enters the required contact details
UniLink validates the entered details
UniLink adds the new contact
UniLink displays the updated contact list
Use case ends.
Extensions
3a. The entered data is invalid
3a1. UniLink shows an error message indicating fields that could be incorrect.
3a2. User re-enters the new data
Steps 3a1-3a2 are repeated until the data entered is correct.
Use case resumes from step 4.
3b. User enters a duplicate contact.
3b1. UniLink shows an error message indicating the contact already exists.
Use case ends.
Use case: UC002 - Delete a person
MSS
User requests to list persons
UniLink shows a list of persons
User requests to delete a specific person in the list
UniLink deletes the specified person from the list
Use case ends.
Extensions
2a. The list is empty.
Use case ends.
3a. The given index is invalid.
3a1. UniLink shows an error message indicating the index is invalid.
Use case resumes at step 2.
Use case: UC003 - Edit a contact
MSS
User requests to list persons
UniLink shows a list of persons
User requests to edit a specific person in the list
User enters the new details for the contact to be updated
UniLink updates the contact
UniLink displays the updated contact list
Use case ends.
Extensions
2a. The list is empty.
Use case ends.
3a. The given index is invalid.
3a1. UniLink shows an error message indicating the index is invalid.
Use case resumes at step 2.
4a. The entered data is invalid
Steps 4a1-4a2 are repeated until the data entered is correct.
Use case resumes from step 5.
4b. The edited contact results in a duplicate
Use case ends.
Use case: UC004 - View contact list
MSS
User requests to view the list of persons
UniLink shows the full list of persons with basic contact details.
Use case ends.
Extensions
2a. The list is empty.
Use case ends.
Use case: UC005 - Switch Theme
MSS
User requests to switch theme
UniLink changes the theme to the specified option (e.g., light or dark mode)
Use case ends.
Extensions
1a. The given theme is invalid.
1a1. UniLink shows an error message indicating that the theme is invalid.
Use case resumes at step 1.
Use case: UC006 - Find contacts by name
MSS
User requests to find contacts by name
User enters a keyword representing part or all of a contact’s name
UniLink shows a list of persons with names containing the keyword
Use case ends.
Extensions
2a. The entered data is invalid
2a1. UniLink shows an error message
2a2. User re-enters a new keyword
Steps 2a1-2a2 are repeated until the data entered is correct.
Use case resumes from step 3.
Use case ends.
Use case: UC007 - Filter contacts by contact type
MSS
User requests to filter contacts by contact type
User specifies the contact type they want to filter by
UniLink shows a list of contacts that match the specified contact type
Use case ends.
Extensions
2a. The specified contact type is invalid
2a1. UniLink shows an error message indicating the contact type is invalid
Use case resumes from step 1.
3a. No contacts match the specified contact type
Use case ends.
Use case: UC008 - Import contacts from .csv file
MSS
Extensions
1a. There is no Import folder
1a1. UniLink shows error message
1a2. User restarts program to re-initialise Import folder
Use case resumes from step 1
1b. The .csv file is empty
1b1. UniLink shows error message
1b2. User attempts to import another .csv file
Use case resumes from step 1
3a. One (or more) of the contacts are invalid (Do not have valid contact info/ missing name/ missing contact type)
3a1. UniLink skips over invalid contacts
Use case resumes from step 3
3b. There are duplicate contacts/ contacts in .csv file already exist in addressbook
3b1. UniLink skips over duplicate contacts
Use case resumes from step 3
{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.
Saving theme preferences
Enter the command switch light
or switch dark
to set the theme of the app. Close the window.
Re-launch the app by double-clicking the jar file.
Expected: The most recent theme is retained.
Adding a person with minimum fields (name, contact type, telegram handle)
Test case: add n/Nicole Lee ct/work h/@nicole_lee
Expected: New contact added to the list with the details provided. Details of the added contact are shown in the status message.
Test case: add n/Nicole 333 ct/work h/@nicole_lee
Expected: No person added. Error details displayed in the status message.
Other incorrect add commands to try: add
, add n/Nicole Lee
, add Nicole Lee
, ...
Expected: Similar to previous.
Adding a person with all fields (name, contact type, telegram handle, phone number, email, module, remark, tags)
Test case: add n/Nicole Lee ct/work h/@nicole_lee p/98765432 e/nicolelee@example.com m/CS2103T r/likes coding t/friend
Expected: New contact added to the list with the details provided. Details of the added contact are shown in the status message.
Test case: add n/Nicole Lee ct/work h/@nicole_lee p/98765432 e/nicolelee@example.com m/CS2103T r/likes coding t/friend t/colleague t/student
Expected: New contact added to the list with the details provided. Details of the added contact are shown in the status message.
Test case: add Nicole Lee work @nicole_lee 98765432 nicole@example.com CS2103T likes coding friend
Expected: No person added. Error details displayed in the status message.
Editing a person's telegram handle from an existing contact
Prerequisites: List all persons using the list
command. Multiple persons in the list.
Test case: edit 1 h/@ashley_
Expected: Telegram handle of first contact updated to @ashley_
. Details of the edited contact are shown in the status message.
Test case: edit 0 h/@ashley_
Expected: No person is edited. Error details shown in the status message.
Other incorrect edit commands to try: edit h/@ashley_
, edit 1 @ashley_
, edit x @ashley_
, ...
(where x is larger than the list size)
Expected: Similar to previous.
Editing multiple fields for an existing contact (e.g. email, telegram handle)
Prerequisites: List all persons using the list
command. Multiple persons in the list.
Test case: edit 1 e/ashley@example.com h/@ashley_
Expected: Email and telegram handle of first contact is updated to ashley@example.com
and @ashley_
respectively. Details of the edited contact are shown in the status message.
Test case edit 0 e/ashley@example.com h/@ashley_
Expected: No person is edited. Error details shown in the status message.
Other incorrect edit commands to try: edit e/ashley@example.com h/@ashley_
, edit 1 e/ashley@example.com @ashley_
, edit e/ashley@example.com h/@ashley_
, ...
Expected: Similar to previous.
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 are shown in the status message.
Test case: delete 0
Expected: No person is deleted. Error details shown in the status message.
Other incorrect delete commands to try: delete
, delete x
, ...
(where x is larger than the list size)
Expected: Similar to previous.
Deleting a person when the list is empty
Prerequisite: Ensure that there are no contacts in the app.
Test case: delete 1
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 can be any number)
Expected: Similar to previous.
Dealing with missing data file
Navigate to ./data/addressbook.json
and delete the addressbook.json
file.
Launch the app by double-clicking the jar file.
Expected: The default list of contacts is loaded.
Dealing with corrupted data file
Navigate to ./data/addressbook.json
. Right click the addressbook.json
file and open in TextEdit.
Delete all the contents of the file and type some symbols (e.g. &*$@
).
Launch the app by double-clicking the jar file.
Expected: The app loads with no contacts.
This project required substantial effort due to the complexity of expanding beyond the initial structure of AddressBook Level 3 (AB3). The following describes the challenges, difficulty level, and effort involved, as well as achievements attained through enhancements and additional features.
In summary, this project required considerable effort due to the added functionality, custom UI work, and enhanced search features. The limited reuse of existing libraries meant most of the code had to be written and adapted by our team, adding to the overall effort invested.
Team Size: 5
edit
command:add n/Amy One ct/personal t/@amyone
add n/Amy Two ct/personal t/@amytwo
edit 2 t/@amyone
edit r/
with 200 characters will show truncated text up to window sizeadd n/Amy ct/work e/amy123@example.com
add n/Bob ct/work e/AMY123@EXAMPLE.COM
add n/Amy ct/work p/87654321 r/12345
find alex
returns only 1 person when using the default addressbook.json, resulting in a white background in the contact list.ct/Work n/John Doe p/98765432 e/johndoe@example.com r/Met at conference
. Currently, the only way to remove the remark field is to delete the entire contact and re-add it without the remark field.edit
command (e.g. edit 1 r/
can delete the remark of the contact).csv
file has only 4 fields filled in and is successfully imported, but a later .csv
file contains the same contact with more fields (e.g., 6 fields), the import function skips the contact as a duplicate without notifying the user..csv
file is missing the contactType
or if the contactType
is invalid, the import function will skip over that contact without any notifications or reasons provided.John Doe
is imported from the first .csv
file with 4 fields filled (ct/Work n/John Doe p/12345678 e/johndoe@example.com
) and a subsequent .csv file
has John Doe
with 6 fields filled, the import function will skip it as a duplicate without any indication or feedback.add n/Amy ct/work t/colleague
, the following error message is displayed.Invalid command format!
add: Adds a person to the address book.
Parameters: n/NAME ct/CONTACT TYPE [h/TELEGRAM HANDLE] [p/PHONE] [e/EMAIL] [m/MODULE NAME] [r/REMARK] [t/TAG]...
Example: add ct/work n/John Doe h/@johndoe m/CS1101S p/98765432 e/johnd@example.com r/likes to eat chocolate t/friends t/owesMoney
Note: At least one field out of phone, email and telegram handle must be provided
add
and edit
commands to accommodate names with special characters, including hyphens, cultural identifiers (e.g., "d/o," "s/o"), and symbols. This update will allow users to input and maintain detailed and accurate records, ensuring all details are captured precisely.find
to findname
for clarityfind
command may cause confusion, as it only searches by names. This can be unclear because there are also separate findtele
and findtag
commands that search for Telegram handles and tags respectively.find alex
, this find command for names is inconsistent compared to findtele and findtag.find
command to findname
to standardise with the other find commands.