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, ContactListPanel,
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 Contact 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 contact).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,
Contact objects (which are contained in a UniqueContactList object).Contact objects (e.g., results of a search query) as a separate displayed list
which is exposed to outsiders as an unmodifiable ObservableList<Contact> 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.UserPrefs object that represents the user’s preferences. This is exposed to the outside as a
ReadOnlyUserPrefs object.Model represents data entities of the domain, they
should make sense on their own without depending on other components)Each Contact also carries:
UUID (persisted in JSON), used when notes store cross-references to other contacts; commands that
resolve @INDEX in note text use the displayed contact list at parse time.LastContacted for when the contact was last reached (flexible user phrasing, e.g. relative or absolute
dates).LastUpdated, always present (LocalDateTime), typically set to “now” when a contact is added or edited through
the usual code paths; used for ordering and display logic.Note values: plain text plus an optional reminder; after parsing, stored text may contain @{UUID}
cross-references to other contacts. Note command feedback uses Messages.formatNoteOutput (which uses
Contact.getNotesString()); the GUI can resolve references when rendering (e.g. NoteLabel).Tag instances; in practice some entries are RankedTag (a subclass of Tag) for ranked friend
tags—the class diagram shows only Tag to keep the overview simple.Implementation detail (omitted from the model diagram): both LastContacted and optional note reminders are
represented using TimePoint from seedu.address.commons.core.timepoint for parsing and comparing those time
phrases.
JsonAdaptedContact persists lastUpdated, lastContacted, and notes alongside the other contact fields.
Note: The diagram below is an alternative (arguably more OOP) design: a central Tag list on AddressBook that
Contact references, so each unique tag exists once. The running app does not use this structure—AddressBook only
contains a UniqueContactList, and each Contact owns its own Tag instances as in the main model diagram above.

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 edit command supports removing optional fields (phone, email, address, last contacted date) by supplying the field prefix with no argument. For example, edit 1 p/ removes the phone number from the first contact.
The following sequence diagram shows how the edit field removal mechanism works when the user executes edit 1 p/:
EditCommandParser detects the empty value for the p/ prefix and sets clearPhone = true in the EditContactDescriptor.EditCommand#createEditedContact() checks the clear flag — if clearPhone is true, updatedPhone is set to Optional.empty().Aspect: How empty prefix values are handled:
Alternative 1 (current choice): Dedicated boolean clear flags (clearPhone, clearEmail, etc.) in EditContactDescriptor.
Alternative 2: Use a sentinel value (e.g. empty string) to represent removal.
Optional<Phone> field.Phone, Email, etc. would need special-case handling.The undo/redo mechanism is facilitated by Snapshot. It stores key information regarding a Model, stored internally as an List<Pair<String, Snapshot>> named snapshots and an int snapshotPosition is used to indicate the Snapshot being used. Additionally, Model implements the following methods:
saveSnapshot(String description) — Saves the current Model state with a name for user reference.moveSnapshot(int offset) — Moves the Model by offset number of snapshots in its history.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 ModelManager, the instantiable version of Model, will be initialized with the initial snapshotPosition of 0, and a singular snapshot in snapshots representing the ModelManager's current state.
Step 2. The user executes add n/John … command to add a new contact. The add command calls Model#saveSnapshot(feedback), where feedback is the string in the CommandResult from executing the AddCommand, "New contact added: John…", thus a snapshot of the ModelManager after the add n/John… command executes to be saved in snapshot, and the snapshotPosition is incremented.
Step 3. The user executes delete 7 to delete the 7th contact which happens to be the most recently added contact. The delete command also calls Model#saveSnapshot(feedback), causing another snapshot to be saved into snapshots.
Note: If a command fails its execution, it will not call Model#saveSnapshot(feedback), so no new snapshot will be created.
Step 4. The user now decides that deleting the contact was a mistake, and decides to undo that action by executing the undo command. The undo command will call Model#moveSnapshot(-1), which will decrement snapshotPosition, and restores ModelManager with data given by the snapshotPosition-th snapshot.
Note: If snapshotPosition is 0, pointing to the initial Model's snapshot, then there are no previous snapshot to restore to. In this case an IndexOutOfBoundsException will be thrown.
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#moveSnapshot(1). If snapshotPosition is less than snapshots.size() - 1, snapshotPosition is incremented, then the snapshotPosition-th snapshot is retrieved to restores the ModelManager to the state it represents.
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#saveSnapshot() or Model#moveSnapshot(). Thus, the snapshotPosition remains unchanged.
Step 6. The user executes clear, which calls Model#saveSnapshot(). Since the snapshotPosition is not equal to snapshots.size() - 1, all snapshots after the snapshotPosition-th snapshot will be purged. Reason: It no longer makes sense to redo the delate 7 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 a compact copy of the model.
Alternative 2: Save an 'undo/redo' version of each command.
delete, just save the contact being deleted).{more aspects and alternatives to be added}
{Explain here how the data archiving feature will be implemented}
Target user profile:
Value proposition: Allow better management of long term relationships with big companies and clients through a simple, unified interface. Provide users with quick, up-to-date access to clients’ data and relevant services necessary for quick and on-point responses.
Priorities: High (must have) - * * *, Medium (nice to have) - * *, Low (unlikely to have) - *
| Priority | As a … | I want to … | So that I can… |
|---|---|---|---|
* * * | consultant | record clients' contact details | retrieve them later |
* * * | consultant | retrieve clients' contact details | contact them again |
* * * | consultant | delete client's contact details | curate contacts and comply with data protection laws |
* * * | existing user | check how to do a task / action | use the app |
* * | consultant | view an individual client's contact details | look at their information in detail |
* * | user with many clients | find a person's contact by entering their name | easily contact them again even amongst an ocean of contacts |
* * | user with many clients | manually organise clients by importance / relevance | check up on them first |
* * | user with many clients | sort profile data by last updated | check for outdated profiles that require updating |
* * | security-conscious user | password-protect some sensitive information | ensure privacy for profiles |
* * | potential user | review its functionalities without spending too much time | understand how the app will help me |
* * | migrating user | load existing client data as a file | easily migrate clients over to the app |
* * | migrating user | create incomplete data profiles to be updated later | migrate existing clients over more gradually |
* * | consultant | search for profiles by tags such as industry, occupation, company etc. | quickly find contacts of services that may be useful to my client |
* * | consultant | search for profiles by fields such as location and email keywords | quickly find contacts with limited information |
* * | consultant | be reminded of upcoming appointments | do not miss them |
* * | consultant | edit client's contact details | correct mistakes and comply with data protection laws |
* * | consultant | sort contacts by relationship level or commission fees | find the most suitable help for my clients while balancing other factors such as budget |
* * | consultant | update existing business information | correct mistakes / obsolete data and comply with data protection laws |
* * | consultant | delete existing business information | remove obsolete data and comply with data protection laws |
* * | consultant | store relevant business information to a client | save time looking it up in a separate app / physically |
* * | consultant | retrieve relevant business information to a client | save time looking it up in a separate app / physically |
* * | consultant | sort contacts by last contacted | keep track of cold contacts |
* * | busy consultant | see a clear dashboard overview of recently contacted clients | get straight to work without navigating through complex menus. |
* | user | undo accidental actions | prevent permanent data loss from mistakes |
* | user | attach PDF contracts or brand guidelines to a client profile | quickly retrieve them for reference |
* | typing user | easily input clients' data through file-editing | speed up my workflow |
* | proficient user | archive old projects | my active workspace remains uncluttered |
* | power user | use keyboard shortcuts or task automation | efficiently execute repeated tasks |
* | potential user | simulate my usual workflow with mock data | get hands-on experience with the functionalities |
* | new user | follow a simple guided setup | customize the app to my needs and preferences |
* | forgetful user | utilise fuzzy search even within commands | easily use the retrieve data without clear memory of the commands or target details |
* | dark-mode user | set the app to dark mode | reduce eye strain during late-night event planning |
* | light-mode user | set the app to light mode | improve readability in well-lit environments |
* | consultant | take down minutes during a discussion | remember and reference them later |
* | consultant | cross reference tool which vendors have worked with which clients before | understand relationships quickly |
* | consultant | automatically send emails to old clients | follow up and keep contacts warm |
* | consultant | save availability information for selected contacts as a calendar and filter contacts based on availability | later on, I know when they can be contacted in person rather than needing to double-check ahead of time |
* | beginner user | pick up advanced functionalities gradually | utilize more of the features provided |
{More to be added}
(For all use cases below, the System is the B2B4U and the Actor is the user, unless specified otherwise)
Use case: UC1 - Check User Guide
MSS
User requests user guide
B2B4U provides user guide
Use case ends
Use case: UC2 - Add a contact
MSS
User requests to create a new contact with certain parameters
B2B4U saves the new contact
B2B4U displays confirmation that the new contact is saved
Use case ends
Extensions
1a1. B2B4U shows an error message
Use case ends.
Use case: UC3 - View all contacts
MSS
User requests to list contacts
B2B4U shows a list of all stored contacts
Use case ends.
Use case: UC4 - Delete a contact
MSS
User requests to view contacts (UC3)
User requests to delete a specific contact in the list
B2B4U deletes the contact
Use case ends.
Extensions
1a. The list is empty.
Use case ends.
2a. The given index is invalid.
2a1. B2B4U shows an error message.
Use case resumes at step 1.
Use case: UC5 - Filter contacts by criterion
MSS
User requests to list contacts which fulfill given criteria
B2B4U shows a list of all contacts which fulfill given criteria
Use case ends.
Use case: UC6 - Sort contacts by criterion
MSS
User requests to list contacts sorted by a given criteria
B2B4U shows a list of all contacts in order of given criteria
Use case ends.
{More to be added}
17 or above installed.{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.
Deleting a contact while all contacts are being shown
Prerequisites: List all contacts using the list command. Multiple contacts 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 contact 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.
Dealing with missing/corrupted data files
Prerequisites: Ensure that app is closed. preferences.json and config.json files are present in the same folder as the jar file.
Test case: Delete data file (if present) and launch the app.
Expected: App loads with no contacts. A new data file is created when a contact is added.
Test case: Corrupt data file (e.g. by adding random text to the file) and launch the app.
Expected: App loads with no contacts. The data file is overwritten when a contact is added.