By: Team SE-EDU
Since: Jun 2016
Licence: MIT
- 1. Setting up
- 2. Design
- 3. Implementation
- 3.1. Google Implementation
- 3.2. EasyFind mechanism
- 3.3. Finding Contacts by Tags
- 3.4. Birthdays
- 3.5. Representation of birthdays
- 3.6. Validation of birthday
- 3.7. Implementation of List Tags
- 3.8. Implementation of Facebook Field
- 3.9. Undo/Redo mechanism
- 3.10. Task class mechanism
- 3.11. Send email mechanism
- 3.12. Logging
- 3.13. Configuration
- 4. Documentation
- 5. Testing
- 6. Dev Ops
- Appendix A: Suggested Programming Tasks to Get Started
- Appendix B: User Stories
- Appendix C: Use Cases
- Appendix D: Non Functional Requirements
- Appendix E: Glossary
-
JDK
1.8.0_60
or laterℹ️Having any Java 8 version is not enough.
This app will not work with earlier versions of Java 8. -
IntelliJ IDE
ℹ️IntelliJ by default has Gradle and JavaFx plugins installed.
Do not disable them. If you have disabled them, go toFile
>Settings
>Plugins
to re-enable them.
-
Fork this repo, and clone the fork to your computer
-
Open IntelliJ (if you are not in the welcome screen, click
File
>Close Project
to close the existing project dialog first) -
Set up the correct JDK version for Gradle
-
Click
Configure
>Project Defaults
>Project Structure
-
Click
New…
and find the directory of the JDK
-
-
Click
Import Project
-
Locate the
build.gradle
file and select it. ClickOK
-
Click
Open as Project
-
Click
OK
to accept the default settings -
Open a console and run the command
gradlew processResources
(Mac/Linux:./gradlew processResources
). It should finish with theBUILD SUCCESSFUL
message.
This will generate all resources required by the application and tests.
-
Run the
seedu.address.MainApp
and try a few commands -
Run the tests to ensure they all pass.
This project follows oss-generic coding standards. IntelliJ’s default style is mostly compliant with ours but it uses a different import order from ours. To rectify,
-
Go to
File
>Settings…
(Windows/Linux), orIntelliJ IDEA
>Preferences…
(macOS) -
Select
Editor
>Code Style
>Java
-
Click on the
Imports
tab to set the order-
For
Class count to use import with '*'
andNames count to use static import with '*'
: Set to999
to prevent IntelliJ from contracting the import statements -
For
Import Layout
: The order isimport static all other imports
,import java.*
,import javax.*
,import org.*
,import com.*
,import all other imports
. Add a<blank line>
between eachimport
-
Optionally, you can follow the UsingCheckstyle.adoc document to configure Intellij to check style-compliance as you write code.
After forking the repo, links in the documentation will still point to the se-edu/addressbook-level4
repo. If you plan to develop this as a separate product (i.e. instead of contributing to the se-edu/addressbook-level4
) , you should replace the URL in the variable repoURL
in DeveloperGuide.adoc
and UserGuide.adoc
with the URL of your fork.
Set up Travis to perform Continuous Integration (CI) for your fork. See UsingTravis.adoc to learn how to set it up.
Optionally, you can set up AppVeyor as a second CI (see UsingAppVeyor.adoc).
ℹ️
|
Having both Travis and AppVeyor ensures your App works on both Unix-based platforms and Windows-based platforms (Travis is Unix-based and AppVeyor is Windows-based) |
When you are ready to start coding,
-
Get some sense of the overall design by reading the Architecture section.
-
Take a look at the section Suggested Programming Tasks to Get Started.
Figure 2.1.1 : Architecture Diagram
The Architecture Diagram given above explains the high-level design of the App. Given below is a quick overview of each component.
💡
|
The .pptx files used to create diagrams in this document can be found in the diagrams folder. To update a diagram, modify the diagram in the pptx file, select the objects of the diagram, and choose Save as picture .
|
Main
has only one class called MainApp
. It is responsible for,
-
At app launch: Initializes the components in the correct sequence, and connects them up with each other.
-
At shut down: Shuts down the components and invokes cleanup method where necessary.
Commons
represents a collection of classes used by multiple other components. Two of those classes play important roles at the architecture level.
-
EventsCenter
: This class (written using Google’s Event Bus library) is used by components to communicate with other components using events (i.e. a form of Event Driven design) -
LogsCenter
: Used by many classes to write log messages to the App’s log file.
The rest of the App consists of four components.
Each of the four components
-
Defines its API in an
interface
with the same name as the Component. -
Exposes its functionality using a
{Component Name}Manager
class.
For example, the Logic
component (see the class diagram given below) defines its API in the Logic.java
interface and exposes its functionality using the LogicManager.java
class.
Figure 2.1.2 : Class Diagram of the Logic Component
The Sequence Diagram below shows how the components interact for the scenario where the user issues the command delete 1
.
Figure 2.1.3a : Component interactions for delete 1
command (part 1)
ℹ️
|
Note how the Model simply raises a AddressBookChangedEvent when the Address Book data are changed, instead of asking the Storage to save the updates to the hard disk.
|
The diagram below shows how the EventsCenter
reacts to that event, which eventually results in the updates being saved to the hard disk and the status bar of the UI being updated to reflect the 'Last Updated' time.
Figure 2.1.3b : Component interactions for delete 1
command (part 2)
ℹ️
|
Note how the event is propagated through the EventsCenter to the Storage and UI without Model having to be coupled to either of them. This is an example of how this Event Driven approach helps us reduce direct coupling between components.
|
The sections below give more details of each component.
Figure 2.2.1 : Structure of the UI Component
API : Ui.java
The UI consists of a MainWindow
that is made up of parts e.g.CommandBox
, ResultDisplay
, PersonListPanel
, TaskListPanel
, StatusBarFooter
, BrowserPanel
etc. All these, including the MainWindow
, inherit from the abstract UiPart
class.
The UI
component uses 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,
-
Executes user commands using the
Logic
component. -
Binds itself to some data in the
Model
so that the UI can auto-update when data in theModel
change. -
Responds to events raised from various parts of the App and updates the UI accordingly.
Figure 2.3.1 : Structure of the Logic Component
Figure 2.3.2 : Structure of Commands in the Logic Component. This diagram shows finer details concerning XYZCommand
and Command
in Figure 2.3.1
API :
Logic.java
-
Logic
uses theAddressBookParser
class to parse the user command. -
This results in a
Command
object which is executed by theLogicManager
. -
The command execution can affect the
Model
(e.g. adding a person) and/or raise events. -
The result of the command execution is encapsulated as a
CommandResult
object which is passed back to theUi
.
Given below is the Sequence Diagram for interactions within the Logic
component for the execute("delete 1")
API call.
Figure 2.3.1 : Interactions Inside the Logic Component for the delete 1
Command
Figure 2.4.1 : Structure of the Model Component
API : Model.java
The Model
,
-
stores a
UserPref
object that represents the user’s preferences. -
stores the Address Book data.
-
exposes an unmodifiable
ObservableList<ReadOnlyPerson>
andObservableList<ReadOnlyTask>
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. -
does not depend on any of the other three components.
Figure 2.5.1 : Structure of the Storage Component
API : Storage.java
The Storage
component,
-
can save
UserPref
objects in json format and read it back. -
can save the Address Book data in xml format and read it back.
This section describes some noteworthy details on how certain features are implemented.
Contact’em now incorporates and integrates Google Contacts and Gmail which will enhance its usability. Firstly,
Login Command
is implemented so that the Contact’em can authenticate with the google servers when the user has successfully logged in.
The new GoogleAuthenticator
class is created to run the authentication process.
The Login Command
sequence diagram is as follows:
Figure 3.1.1 : Login command sequence diagram
The login page will be loaded in the browser panel after the login command has successfully executed. This is for the user to authenticate with google. Contact’em will then redirect the user to the Google contacts web page after successful authentication.
The GoogleContactsBuilder
class can be instantiated to access the list of contacts from Google and also to obtain the PeopleService
object needed to modify the contacts in Google. This is done by making use of the methods in the GoogleAuthenticator
object to obtain the access token and PeopleService
from Google.
The token required for authentication is obtained from the redirect url after logging in. This means that the user must stay on the Google contacts page in the browser panel when instantiating this class (For import / export / sync
commands). The class diagram for GoogleContactsBuilder
is shown below.
Figure 3.1.1.1 : GoogleContactsBuilder class diagram
Every Person in the address book now has a new attribute known as the GoogleID. This ID refers to its own GoogleID in Google contacts. Contacts that are not synchronised with Google will have a null GoogleID.
After successful authentication, the user can proceed to import contacts from his google account. The import command creates a GoogleContactsBuilder
object to retrieve the list of google contacts from the server.
The Import command
sequence diagram is as follows:
Figure 3.1.2.1 : Import command sequence diagram
When the command is executed, the list of Google contacts will be looped through and compared with the contacts in Contact’em. If the GoogleID of a particular Google contact is not found in Contact’em, the contact will be imported. This is represented by the code snippet as shown below.
Pseudo-code snippet:
for each contact: googleContactsList {
if contact does not exists in Contact’em
model.addPerson(newPerson(contact))
}
Scenario 1
The newPerson(…) method shown in the above code snippet successfully creates a Person object using attributes from the Google contact and it will be added to the address book. The GoogleID of the contact will also be instantiated within the new Person Object. The Person will also be given a GoogleContact Tag.
Scenario 2
The newPerson(…) method fails to create a Person object from the Google contact. The Google contact will fail to import. Reasons for the above mentioned failure includes,
1) Google contact might have invalid attributes. Eg: Invalid email format
2) Google contact might not have all attributes required to create a new Person object.
All the following attributes must be present: Name, Phone, Email and Address.
A message detailing the result of the command will be displayed to inform the user on the number of contacts imported or the number of contacts along with a string of names of contacts that failed to import.
After successful authentication, the user can next proceed to export contacts from Contact’em into his google account. The command creates a GoogleContactsBuilder object to retrieve peopleService from google which is required to modify/add contacts in Google.
The Export command
sequence diagram is as follows:
Figure 3.1.3.1 : Export command sequence diagram
When the command is executed, the list of contacts in Contact’em will be looped through to check whether they are a google contact. If they are not, they will be exported to Google contacts. This is represented by the code snippet shown below.
Pseudo-code snippet
for each contact: addressBookList{
if contact does not have a GoogleContact Tag
New googleContact = createGoogleContact (contact);
googleContact = builder.getPeopleService().people() createContact(googleContact).
execute();
model.updatePerson(contact, newAddressBookContact(contact));
}
Scenario 1
The createGoogleContact method shown in the above code snippet successfully creates a GooglePerson that will be exported to Google contacts. The export command will then update the contact by instantiating its GoogleID attribute retrieved from the newly created Google contact and adding a GoogleContacts tag to it.
Scenario 2
The contact might not be exported to Google due to the failure in connecting to Google servers. This is can be due to token expiring.
A message detailing the result of the command will be displayed to inform the user on the number of contacts imported or failed to import.
After successful authentication, the user can proceed to sync contacts in Contact’em. The sync command creates a GoogleContactsBuilder object to retrieve the list of Google contacts from the server. In this case, the contacts in Google contacts takes higher precedence and any changes to them will be updated to the contacts in Contact’em when the user syncs. However, any changes made to the contacts in the Contact’em will not be transferred to Google contacts when the user syncs but instead, its attribute will be restored to its original value.
The Sync command
sequence diagram is as follows:
Figure 3.1.4.1 : Sync command sequence diagram
When the command is executed, the list of contacts in Contact’em will be looped through to check if they exists within the list of Google contacts. If they are, a Person object based on the Google contact will be created and it will be used to compare with the contact in the Contact’em. This is represented by the code snippet shown below.
Pseudo-code snippet:
for each contact: addressBookList{
for each googlecontact : googleContactsList{
if contact shares a similar googleID with the googlecontact
exists = true;
if convertToAddress(googlecontact) is not the same as contact
model.updatePerson(contact, convertToAddress(googlecontact))
}
if contact is a google contact but exists == false
model.updatePerson(contact, removeGoogleContactStatus(contact));
}
Scenario 1
The attributes of the contact are the same as itself in Google contacts. No synchronising will be done on that contact.
Scenario 2
The attributes of the contact are different from itself in Google contacts. A newly created contact will replace the previous contact as shown in the above code snippet in model.updatePerson(…).
Scenario 3
The format of the Google contact is invalid and hence no new Person is created for comparison with the contact in Contact’em. The contact in the Contact’em will not be synchronised.
Scenario 4
The contact in the Contact’em is thought to exist in Google contacts but is not found. The removeGoogleContactStatus() method shown in the above code snippet will remove the Google contact status of the contact.
A message detailing the result of the command will be displayed to inform the user on the number of contacts synced and the number of contacts along with a string of names of contacts that failed to sync.
Aspect: Storage of access token.
Alternative 1 (current choice): Users have to be on the Google contact web page in order to use the following commands : Import
, Export
, Sync
. This is because the token is retrieved from the url every time the user uses the above mentioned commands.
Pros: Users will be able to inspect the contacts within the Google contacts and they will be able to update the contacts if the contacts fail to import or synchronise by referring to the warning messages displayed.
Cons: This might cause some inconvenience because the users have to re-login to use the above mentioned commands if they have switched pages in the browser panel.
Alternative 2: Stores the token within the program once the user has logged in.
Pros: More convenience for user as they do not have to stay on the Google contacts page whenever they want to use the above mentioned commands.
Cons: In the case when some contacts fail to synchronise or import, the user have to re-login anyway to check on the contacts in google. By doing so, the error message produced earlier on will be removed and the user does not have a reference to see which contact is not importing or synchronising.
Aspect: Precedence of Google contacts over Contact’em contacts in sync command
Alternative 1 (current choice): Google contacts takes higher precedence. Contacts updated in Google contacts will be synchronised to Contact’em.
Pros: This alternative allow users to update contacts in Google contacts on-the-go which can be synchronised to Contact’em next time they use it.
Cons: Contacts updated in Contact’em must be manually updated in the Google contacts as well. If not, next time when the user synchronises Contact’em, the changes will be removed.
Alternative 2: Contact’em takes higher precedence. Contacts updated in Contact’em will be synchronised to Google contacts.
Pros: This is better for user who uses Contact’em more often than Google contacts. For some, the contacts in Google contacts might just be an on-the-go reference and most updating is done within Contact’em.
Cons: Will not be able to update contacts if they are away from the computer.
The EasyFind mechanism is an action driven task, which activates when the user tries to search for a contact by updating the search results whenever the user inputs a letter into the command box.
The mechanism is facilitated by a new command FindLettersCommand
which will search for contacts matching the letters in the command box. The command is called every time the user inputs or remove a character from the command box while using the command Find
.
The key release event of the command box is constantly searching for the term find
and when the user inputs the mentioned term into the command box, the key release event will begin searching for contacts by passing the letters entered after the term find
into FindLettersCommand
.
The application will display the number of contacts that share the same letters as the input.
ℹ️
|
After the user inputs enter , normal find command will be executed
|
ℹ️
|
EasyFind mechanism is case insensitive |
The following sequence diagram shows how the FindLettersCommand
works:
Figure 3.2.1 : FindLettersCommand sequence diagram
Aspect: Intertwining of FindLettersCommand
and FindCommand
Alternative 1 (current choice): Separate both commands.
Pros: We will not lose the original functionality of the FindCommand
and creating a new FindLettersCommand
allows the application to search for contacts more frequently when the EasyFind mechanism is activated.
Cons: This might confuse the user as the FindCommand
and FindLettersCommand
could generate different results. The contact that the user is searching for may be displayed when a partial name is inputted. However, when the user inputs enter
before typing in the full name, the displayed contact will be removed by the original FindCommand
Alternative 2: Replace FindCommand
with FindLettersCommand
Pros: The results displayed will not change even after the user has pressed enter
. It can also help the user to speed up the process of searching for contacts as they user does not have to input the full name
Cons: Removing the find Command may affect other functions of Contact’em.
The application allows users to find contacts based on their tags. The command word is findtags
, and the alternatives are findtag
and ft
. The following subsections explain how the program is supposed to function given this command, and how it is implemented.
There are three ways to use this command. Some pseudo-code is provided for each of these 3 scenarios to aid understanding.
Scenario 1
In the first scenario, also the most basic, the user only specifies tags to include. For this, the program should simply return all contacts that have at least one of the tags.
Example Command 1: findtags friends
Expected result: returns contacts that are tagged “friends”.
Pseudo-code snippet
for each tag : contact.getTagList {
if (keywordsToInclude.hasAnyMatchingWordsWith(tag.value)) {
return true;
}
}
return false;
Scenario 2
In the second scenario, the user only specifies tags to exclude. To specify a tag to exclude, user includes a hyphen "-" before the keyword to be excluded. In this case, the program should return all contacts that do not have any of these tags to be excluded.
Note that this includes contacts with no tags.
Example Command 2: findtags -colleagues
Expected result: returns all contacts not tagged “colleagues”.
Pseudo-code snippet
for each tag : contact.getTagList {
if (keywordsToExclude.hasAnyMatchingWordsWith(tag.value)) {
return false;
}
}
return true;
Scenario 3
In the third scenario, the user specifies both tags to include and exclude. The program will return all contacts that have:
1) ANY of the tags to include.
2) NONE of the tags to exclude.
Example Command 3: findtags friends -colleagues
Expected result: returns all contacts tagged “friends” but not tagged “colleagues”.
Pseudo-code snippet:
boolean personHasAtLeastOneMatchingTag = false;
for each tag : contact.getTagList {
if keywordsToExclude.hasAnyMatchingWordsWith(tag.value)
return false;
if keywordsToInclude.hasAnyMatchingWordsWith(person.getTagList()
personHasAtLeastOneMatchingTag = true;
}
if (personHasAtLeastOneMatchingTag)
return true;
else
return false;
ℹ️
|
There must be at least one parameter specified, but the order of parameters entered does not matter. |
3 diagrams are provided below to help illustrate a big picture view of the command.
Figure 3.3.2.1 : Class Diagram of Find Tags Command
Firstly, Figure 3.3.2.1 above is the class diagram of this command, which should provide a basic understanding of the classes involved.
Figure 3.3.2.2 : Brief Overview of Find Tags Command Procedure
Secondly, Figure 3.3.2.2 above is the activity diagram of the command. As you can see, the entire command consists of 4 main steps:
1) The parameters are parsed and deciphered.
2) Using the deciphered information from step 1, the Predicate and Command are constructed.
3) Command is executed.
4) Predicate is called and the Model is updated.
More detailed explanations and elaborations are given in the subsections below.
The parser associated with this command is FindPersonsWithTagsCommandParser, under seedu.address.logic.parser. Due to this parser’s long name, it will be referred to as the “command parser” or simply “parser” within this section to aid clarity.
When this command is invoked by the user, this command parser will be constructed by AddressbookParser, receiving the user’s input as a String parameter. The command parser deciphers the input, and eventually returns a FindPersonsWithTagsCommand for execution.
The command parser first checks if the arguments are valid. If the arguments are empty, a ParseException will be thrown for invalid arguments. If the arguments are valid (non-empty), they are split into individual keywords and stored in a String array tagKeywords.
Figure 3.3.3.1 : Splitting Up Keywords
As the diagram above shows, the keywords are split by the spaces in between each word, and each of these words are stored in a String array tagKeywords.
The array of keywords is then passed into the parser’s private method, getImprovedList(), to retrieve a more comprehensive list of tags in addition to the original list of keywords.
ℹ️
|
The details of getImprovedList are not crucially important to the functionality of the parser, and is thus omitted here, but included in the addendum in Section 3.3.6. |
After obtaining the improved list, the parser constructs the command Predicate (details in Section 3.3.4), and the Command itself (details in the Section 3.3.5). Then it returns the Command to AddressbookParser and then the LogicManager for execution.
The Predicate associated with this functionality is called PersonContainsTagsPredicate, found in seedu.address.model.person.
This Predicate has three attributes, keywords, which are generated in the parser, and 2 lists, keywordsToInclude and keywordsToExclude. The 2 lists are generated from keywords.
After this Predicate is constructed, it is used in the constructor of a FindPersonsWithTagsCommand and becomes that command’s attribute.
When the command is executed, this Predicate will be called for every contact in the address book to determine if a contact should be filtered or not based on the user’s inputs.
To do so, the test method of this Predicate is used, which returns a Boolean value: true if this contact should be returned, and false otherwise.
Within this test method, the following steps occur, for each contact in the currently stored in the application:
Figure 3.3.4.1 : Findtags Predicate Activity Diagram
As seem from Figure 3.3.4.1, firstly, all of the person’s tags, if any, are appended to a String allTagNames. For example, if a contact has tags "friends" and "colleagues", the resulting String is "friends colleagues".
Then, the comparison is made between allTagNames and the 2 lists generated in constructor, to return the appropriate Boolean value. Below is the code snippet used in the comparison. Note that this is not the only way to implement this comparison.
Code Snippet:
//For scenario 2
if (onlyKeywordsToExcludeAreSpecified) {
return !(keywordsToExclude.stream()
.anyMatch((keyword -> StringUtil.containsWordIgnoreCase(allTagNames, keyword))));
}
//For scenarios 1 and 3
return keywordsToInclude.stream()
.anyMatch(keyword -> StringUtil.containsWordIgnoreCase(allTagNames, keyword)) &&
!(keywordsToExclude.stream()
.anyMatch((keyword -> StringUtil.containsWordIgnoreCase(allTagNames, keyword))));
The command executed in this feature is FindPersonsWithTagsCommand, found in seedu.address.logic.commands.
After the command parser returns the command to AddressbookParser and then to the LogicManager, assuming that no exceptions are thrown so far, the command is executed, by calling its execute() method.
In this execute() method, the current model invokes its updateFilteredPersonList method, with the command Predicate as described above as its parameter.
This runs the test() method of the Predicate, which determines the appropriate contacts to filter. This causes the model to update accordingly and filters the contacts displayed in the UI.
Finally, this command returns a CommandResult, which includes the number of contacts being displayed. This value is displayed on the UI command box for the user’s reference.
Implementation of getImprovedList
In the command parser (as detailed in Section 3.3.3), there exists a private method getImprovedList(), which takes in the list of keywords entered by the user and attempts to return a more comprehensive one in addition to the original list, to account for grammatical differences in plural and singular forms of the keywords.
To give an example, if the keyword is “friend”, the extra keyword generated is “friends” and vice-versa. This works for “exclusion-keywords” (keywords with a dash in front) as well.
What is of note is that this method is merely a crude, quality-of-life improvement for the user. It simply generates the keywords by appending the letter ‘s’ to keywords which do not end with ‘s’, and removes ‘s’ from words that do end with the letter ‘s’.
As a result, it does not account for words where singular and plural forms differ by more than just a single letter ‘s’, such as “family” and “families”.
It is therefore recommended that future developers improve this method, perhaps by implementing a proper dictionary or library for this method, after weighing the costs and benefits. Alternatively, this idea could be further improved or refined on with a Lookup Table to save file storage space.
Nevertheless, this improvement is meant to increase user enjoyment and convenience. The onus of organising and spelling tags in an organised manner is still on the user. To that end, if the case arises that, based on user feedback, this improvement does more harm than good, it is recommended that this feature be removed or made optional. However, this is not something that the current developers foresee will occur based on observation of how people in general spell their tags.
Aspect: Improving list of keywords.
Alternative 1 (current choice): Add 's' to letters that do not end with 's', and vice-versa.
Pros: Easy to implement and read.
Cons: Does not account for all words in English, may have non-English words.
Alternative 2: Import appropriate library for getting singular/plural words.
Pros: More likely to account for all words.
Cons: May impact performance.
Alternative 3: Implement a Look-up Table.
Pros: Can account for more words than alternative 1, and less impact on performance and storage than alternative 2.
Cons: Might be difficult to implement and may not be as comprehensive as alternative 2.
Aspect: Comparision of tag names and keywords in predicate.
Alternative 1 (current choice): Append names to an empty String for comparision with keywords.
Pros: Easy to implement and change.
Cons: Requires use of lambda, which may be more difficult to understand for beginners.
Alternative 2: Compare tag against tag by encapsulating all keywords into Tags.
Pros: Can use the equals specified in Tag, and/or comparator instead of lambda for better readability.
Cons: More difficult to implement, and may create many tags that are never used because the keywords and expanded to improve user convenience (singular vs plural tag names).
Users are able to store birthdays of their contacts by inputting in the format of ddMMyyyy when adding a person, using the prefix b/
.
In general, the ability to store a person’s birthday was implemented by adding it to the component of Person
.
Storing of birthdays is facilitated by an immutable Birthday
object, which is a component of Person
.
The main classes that implement this attribute is: AddCommand, AddCommandParser, EditCommand, EditCommandParser, Person, PersonListCard.
However, birthday has been made to be an optional field to include while adding a new contact.
Birthday uses the DateFormat and the SimpleDateFormat packages to check if the birthday entered is a valid date. For example, 31/02/1998 is not a valid date.
Validation of birthday is implemented this way:
---
public static boolean isValidBirthday(String test) {
if (test.matches(BIRTHDAY_VALIDATION_REGEX)) {
try {
DateFormat df = new SimpleDateFormat(DATE_FORMAT);
df.setLenient(false);
df.parse(test);
return true;
} catch (ParseException pe) {
return false;
}
} else if (test.matches("")) {
return true;
}
return false;
}
---
Aspect: Representation of birthdays
Alternative 1 (current choice): Display the birthday of the specified contact after the address of the contact
Pros: It follows the format of the person card
Cons: It is difficult to recognise the number displayed is the birthday as it is merely represented as an eight digit number
Alternative 2: Display the birthday with "Birthday:" in front
Pros: Simple and easy to understand
Cons: Inconsistent with the format in person card
The application allows users to see the list of all tags that are currently attached to contacts in the application. The command word is listtags
, and
the shortcut alternative is lt
. The follow subsections explain how the program is supposed to function given the command, and how it is implemented.
In general, when this command is used, there are only 2 scenarios that will occur.
Scenario 1
There is at least 1 tag attached to at least 1 contact.
In this scenario, the application will show these tags in the result box.
Below is the format of the results:
You have the following tags: [tag1] [tag2] [tag3] …
Scenario 2
There are no tags attached to any contacts in the application. This could happen if there are:
1. No contacts in the application.
2. No tags attached to any contact.
In this scenario, the application will show to user the following message:
"You do not have any tags!"
A brief overview of the steps taken by the application in producing the appropriate results is as given:
1. Creates a list of tags by iterating through every Contact in the application and adding their tags to the list.
2. Check if this list of tags is empty or not, that is, whether it is scenario 1 or scenario 2.
2a. If it is scenario 2, that is, there are no tags to output, the command merely returns the failure message.
3. If the list is not empty, it will output the success message along with the list of tags in the appropriate format. The details of this step is given
in the next subsection.
The steps taken are:
1. Converts the list of Tags to a list of String containing the names of each Tag.
2. Sorts the list in alphabetical order.
3. Using a StringBuilder, appends the names to each other with the appropriate formatting.
4. Output the result.
Aspect: Order of Tags displayed
Alternative 1 (current choice): Display in alphabetical order.
Pros: More readable and more easily understood.
Cons: May not be the most meaningful.
Alternative 2: Display based on how many of each tag there are, for example in ascending order.
Pros: Might be more meaningful for certain users and cases.
Cons: Much more difficult to implement, and may appear more confusing to users, as alphabetical order is generally more easily understood.
Alternative 3: Allow option to display both in alphabetical order or in ascending order.
Pros: Best of both worlds, allowing user to choose the most meaningful.
Cons: Adding on to the already numerous commands may not be the most meaningful, especially when the main
function of this enhancement is to complement the find tags feature.
Each contact can now support a Facebook field, which is displayed on the person card.
A few things to note about this field:
-
The Facebook field is not compulsory when adding to the application.
-
If user does not input the Facebook field, removes it using the edit command, it will be replaced by the default Facebook homepage, "https://facebook.com/".
-
User can input Facebook field in 2 ways, the first is the entire link to the Facebook profile. In this case, the program should take the entire link and store it as the Facebook field of the user.
-
If the user enters in the Facebook field a String that is not a link, the programe should assume that what was entered was instead the profile name or profile number of the contact, and thus append the Facebook link prefix to it.
For example, if user enters f/john for a contact, john’s Facebook field would be "https://facebook.com/john/".
To perform steps 3 and 4, the program checks if that is entered in the field is a valid URL. If it is, then assume it is 3. and store the entire URL as the Facebook field. Else, append and store that String as the Facebook field, which is 4.
In future update, will allow select command to open the facebook field instead of google searching the contact’s name.
Aspect: Empty or non-valid URL Facebook fields
Alternative 1 (current choice): Turn it into a proper URL by appending the correct prefixes.
Pros: More readable on the Person Card, user can easily see if there is a mistake.
Cons: May create some strange links.
Alternative 2: Leave it as it is.
Pros: Simple to implement.
Cons: Will look strange and ambiguous on the Person Card, especially if user made a mistake and does not notice.
The undo/redo mechanism is facilitated by an UndoRedoStack
, which resides inside LogicManager
. It supports undoing and redoing of commands that modifies the state of the address book (e.g. add
, edit
). Such commands will inherit from UndoableCommand
.
UndoRedoStack
only deals with UndoableCommands
. Commands that cannot be undone will inherit from Command
instead. The following diagram shows the inheritance diagram for commands:
As you can see from the diagram, UndoableCommand
adds an extra layer between the abstract Command
class and concrete commands that can be undone, such as the DeleteCommand
. Note that extra tasks need to be done when executing a command in an undoable way, such as saving the state of the address book before execution. UndoableCommand
contains the high-level algorithm for those extra tasks while the child classes implements the details of how to execute the specific command. Note that this technique of putting the high-level algorithm in the parent class and lower-level steps of the algorithm in child classes is also known as the template pattern.
Commands that are not undoable are implemented this way:
public class ListCommand extends Command {
@Override
public CommandResult execute() {
// ... list logic ...
}
}
With the extra layer, the commands that are undoable are implemented this way:
public abstract class UndoableCommand extends Command {
@Override
public CommandResult execute() {
// ... undo logic ...
executeUndoableCommand();
}
}
public class DeleteCommand extends UndoableCommand {
@Override
public CommandResult executeUndoableCommand() {
// ... delete logic ...
}
}
Suppose that the user has just launched the application. The UndoRedoStack
will be empty at the beginning.
The user executes a new UndoableCommand
, delete 5
, to delete the 5th person in the address book. The current state of the address book is saved before the delete 5
command executes. The delete 5
command will then be pushed onto the undoStack
(the current state is saved together with the command).
As the user continues to use the program, more commands are added into the undoStack
. For example, the user may execute add n/David …
to add a new person.
ℹ️
|
If a command fails its execution, it will not be pushed to the UndoRedoStack at all.
|
The user now decides that adding the person was a mistake, and decides to undo that action using undo
.
We will pop the most recent command out of the undoStack
and push it back to the redoStack
. We will restore the address book to the state before the add
command executed.
ℹ️
|
If the undoStack is empty, then there are no other commands left to be undone, and an Exception will be thrown when popping the undoStack .
|
The following sequence diagram shows how the undo operation works:
The redo does the exact opposite (pops from redoStack
, push to undoStack
, and restores the address book to the state after the command is executed).
ℹ️
|
If the redoStack is empty, then there are no other commands left to be redone, and an Exception will be thrown when popping the redoStack .
|
The user now decides to execute a new command, clear
. As before, clear
will be pushed into the undoStack
. This time the redoStack
is no longer empty. It will be purged as it no longer make sense to redo the add n/David
command (this is the behavior that most modern desktop applications follow).
Commands that are not undoable are not added into the undoStack
. For example, list
, which inherits from Command
rather than UndoableCommand
, will not be added after execution:
The following activity diagram summarize what happens inside the UndoRedoStack
when a user executes a new command:
Aspect: Implementation of UndoableCommand
Alternative 1 (current choice): Add a new abstract method executeUndoableCommand()
Pros: We will not lose any undone/redone functionality as it is now part of the default behaviour. Classes that deal with Command
do not have to know that executeUndoableCommand()
exist.
Cons: Hard for new developers to understand the template pattern.
Alternative 2: Just override execute()
Pros: Does not involve the template pattern, easier for new developers to understand.
Cons: Classes that inherit from UndoableCommand
must remember to call super.execute()
, or lose the ability to undo/redo.
Aspect: How undo & redo executes
Alternative 1 (current choice): Saves the entire address book.
Pros: Easy to implement.
Cons: May have performance issues in terms of memory usage.
Alternative 2: Individual command knows how to undo/redo by itself.
Pros: Will use less memory (e.g. for delete
, just save the person being deleted).
Cons: We must ensure that the implementation of each individual command are correct.
Aspect: Type of commands that can be undone/redone
Alternative 1 (current choice): Only include commands that modifies the address book (add
, clear
, edit
).
Pros: We only revert changes that are hard to change back (the view can easily be re-modified as no data are lost).
Cons: User might think that undo also applies when the list is modified (undoing filtering for example), only to realize that it does not do that, after executing undo
.
Alternative 2: Include all commands.
Pros: Might be more intuitive for the user.
Cons: User have no way of skipping such commands if he or she just want to reset the state of the address book and not the view.
Additional Info: See our discussion here.
Aspect: Data structure to support the undo/redo commands
Alternative 1 (current choice): Use separate stack for undo and redo
Pros: Easy to understand for new Computer Science student undergraduates to understand, who are likely to be the new incoming developers of our project.
Cons: Logic is duplicated twice. For example, when a new command is executed, we must remember to update both HistoryManager
and UndoRedoStack
.
Alternative 2: Use HistoryManager
for undo/redo
Pros: We do not need to maintain a separate stack, and just reuse what is already in the codebase.
Cons: Requires dealing with commands that have already been undone: We must remember to skip these commands. Violates Single Responsibility Principle and Separation of Concerns as HistoryManager
now needs to do two different things.
The Task
class, which is located inside Model
, is implemented with similar logic as Person
class. We have introduced three commands that modifies the address book: addt
, editt
and deletet
, which extends UndoableCommand
.
A Task
consist of three sub-components: Header
, Desc
and Deadline
. Commands such as undo
and redo
can be used to alter events in the list as they deal with code that directly modifies the address book.
The TaskPanel
is incorporated into the address book MainWindow
to display all the tasks inside the internal list using ObservableList<ReadOnlyTask>
. This process will be explained later on under the section Task card
.
As mentioned earlier, the Task
class contains three main methods: addt
, editt
and deletet
.
The execution flow is similar for all three methods on a higher level.
When the user input a task command with its parameters, the validity of the command word is checked inside the AddressBookParser
. Next, the presence of the parameter prefixes is checked inside AddTaskCommandParser
.
An appropriate ParseException
will be thrown if the command word or prefixes are incorrect.
Before modifying the list of tasks inside the address book, the system may throw exceptions due to some invalid parameters. Here are the possible exceptions:
-
TaskNotFoundException
: This exception can be thrown byeditt
anddeletet
command when the an invalid index for a task is provided by the user. The index needs to be within the size of the task list at the current state of the address book. -
DuplicateTaskException
: This exception can be thrown byaddt
andeditt
command. The system will first create anTask
object with the input parameters, compare the object to all tasks residing in the task list and throw this exception if there is a duplicate found.
Editing of task is implemented this way:
ReadOnlyTask taskToEdit = lastShownList.get(index.getZeroBased());
Task editedTask = createEditedTask(taskToEdit, editTaskDescriptor);
try {
model.updateTask(taskToEdit, editedTask);
} catch (DuplicateTaskException dee) {
throw new CommandException(MESSAGE_DUPLICATE_TASK);
} catch (TaskNotFoundException enfe) {
throw new AssertionError("The target task cannot be missing");
}
model.updateFilteredTaskList(PREDICATE_SHOW_ALL_TASKS);
return new CommandResult(String.format(MESSAGE_EDIT_TASK_SUCCESS, editedTask));
The TaskCard
class extends UiPart<Region>
to represent a distinct part of the UI. The object properties of every task is assigned to a label held by an TaskCard
. The graphic scene is then constructed with the appropriate FXML
files created to support the display of all tasks.
When the user starts the MainApp
, the system calls the UiManager
to create a new MainWindow
and fills it with TaskListPanel
and other components. The displayed events are created by UniqueTaskList
and the binding of individual UI elements to the TaskCard
ensures that any changes to the parameter will be displayed in the TaskListPanel
.
The sequence diagram below illustrates the interaction between the TaskCard
and the UiManager
:
Aspect(future enhancement): How to implement adding/tagging of contacts into a Task
using a Person
list parameter
Chosen Implementation:
Add by the index of contact shown in the PersonListPanel
.
Pros:
The system only has to check for validity of index which leads to increased performance.
Cons:
This requires the user to refer to the PersonListPanel
before executing command to add contact into task’s Person
list.
Alternative: Add by the name of contact in the Person
list.
Pros:
Easier for users to add using names, as they do not need to refer to the Person
list.
Cons:
System has to check through the list to check if the contact’s name exist in the current address book, which can be more difficult if there are more than one contacts with the same name.
The send email mechanism is facilitated by a specific Google account, which the user needs to login to before he can begin using the application to send e-mails. He can then use the command-line interface of the application to add the recipient, subject and body of the e-mail.
E-mails can be sent to the e-mail address attached to any contact in the address book.
Sending of e-mails is implemented this way:
public CommandResult execute() throws CommandException, GoogleAuthException {
requireNonNull(model);
List<ReadOnlyPerson> lastShownList = model.getFilteredPersonList();
if (targetIndex.getZeroBased() >= lastShownList.size()) {
throw new CommandException(Messages.MESSAGE_INVALID_PERSON_DISPLAYED_INDEX);
}
String personToSendEmail = lastShownList.get(targetIndex.getZeroBased()).getEmail().toString();
try {
MimeMessage emailToBeSent = ModelManager.createEmail(personToSendEmail,
EMAIL_SENDER, emailSubject, emailBody);
Gmail gmailService = new GetGmailService().getGmailService();
message = ModelManager.sendMessage(gmailService, EMAIL_SENDER, emailToBeSent);
} catch (MessagingException | IOException E) {
assert false;
}
return new CommandResult(String.format(MESSAGE_SUCCESS));
}
ℹ️
|
Users must login using your e-mail and password to a specific Google account before they can start using this feature. If login is unsuccessful, they will be prompted to login again. |
ℹ️
|
Requested access by Google must be provided before any e-mails can be sent. |
ℹ️
|
Internet connectivity is needed for this feature as the application does not store any e-mail drafts. |
ℹ️
|
Send e-mail feature must be used immediately after login as the application does not store any user data. Hence after login is successful, it is not possible to use other commands and then use the send e-mail command. |
Aspect: Implementation of send e-mail
Alternative 1: Save login details to allow more flexibilty.`
Pros: Easier access to command as users can execute other commands in between login and sending e-mails.
Cons: Security concerns raised as user data is saved within the application.
Alternative 2 (current choice): Only allow users to use send command immediately after login.`
Pros: Safe option as no user details are stored even when the command is used repeatedly.
Cons: Not user-friendly as it forces users to use features of the application in a certain order.
We are using java.util.logging
package for logging. The LogsCenter
class is used to manage the logging levels and logging destinations.
-
The logging level can be controlled using the
logLevel
setting in the configuration file (See Configuration) -
The
Logger
for a class can be obtained usingLogsCenter.getLogger(Class)
which will log messages according to the specified logging level -
Currently log messages are output through:
Console
and to a.log
file.
Logging Levels
-
SEVERE
: Critical problem detected which may possibly cause the termination of the application -
WARNING
: Can continue, but with caution -
INFO
: Information showing the noteworthy actions by the App -
FINE
: Details that is not usually noteworthy but may be useful in debugging e.g. print the actual list instead of just its size
We use asciidoc for writing documentation.
ℹ️
|
We chose asciidoc over Markdown because asciidoc, although a bit more complex than Markdown, provides more flexibility in formatting. |
See UsingGradle.adoc to learn how to render .adoc
files locally to preview the end result of your edits.
Alternatively, you can download the AsciiDoc plugin for IntelliJ, which allows you to preview the changes you have made to your .adoc
files in real-time.
See UsingTravis.adoc to learn how to deploy GitHub Pages using Travis.
We use Google Chrome for converting documentation to PDF format, as Chrome’s PDF engine preserves hyperlinks used in webpages.
Here are the steps to convert the project documentation files to PDF format.
-
Follow the instructions in UsingGradle.adoc to convert the AsciiDoc files in the
docs/
directory to HTML format. -
Go to your generated HTML files in the
build/docs
folder, right click on them and selectOpen with
→Google Chrome
. -
Within Chrome, click on the
Print
option in Chrome’s menu. -
Set the destination to
Save as PDF
, then clickSave
to save a copy of the file in PDF format. For best results, use the settings indicated in the screenshot below.
Figure 5.6.1 : Saving documentation as PDF files in Chrome
There are three ways to run tests.
💡
|
The most reliable way to run tests is the 3rd one. The first two methods might fail some GUI tests due to platform/resolution-specific idiosyncrasies. |
Method 1: Using IntelliJ JUnit test runner
-
To run all tests, right-click on the
src/test/java
folder and chooseRun 'All Tests'
-
To run a subset of tests, you can right-click on a test package, test class, or a test and choose
Run 'ABC'
Method 2: Using Gradle
-
Open a console and run the command
gradlew clean allTests
(Mac/Linux:./gradlew clean allTests
)
ℹ️
|
See UsingGradle.adoc for more info on how to run tests using Gradle. |
Method 3: Using Gradle (headless)
Thanks to the TestFX library we use, our GUI tests can be run in the headless mode. In the headless mode, GUI tests do not show up on the screen. That means the developer can do other things on the Computer while the tests are running.
To run tests in headless mode, open a console and run the command gradlew clean headless allTests
(Mac/Linux: ./gradlew clean headless allTests
)
We have two types of tests:
-
GUI Tests - These are tests involving the GUI. They include,
-
System Tests that test the entire App by simulating user actions on the GUI. These are in the
systemtests
package. -
Unit tests that test the individual components. These are in
seedu.address.ui
package.
-
-
Non-GUI Tests - These are tests not involving the GUI. They include,
-
Unit tests targeting the lowest level methods/classes.
e.g.seedu.address.commons.StringUtilTest
-
Integration tests that are checking the integration of multiple code units (those code units are assumed to be working).
e.g.seedu.address.storage.StorageManagerTest
-
Hybrids of unit and integration tests. These test are checking multiple code units as well as how the are connected together.
e.g.seedu.address.logic.LogicManagerTest
-
See UsingGradle.adoc to learn how to use Gradle for build automation.
We use Travis CI and AppVeyor to perform Continuous Integration on our projects. See UsingTravis.adoc and UsingAppVeyor.adoc for more details.
Here are the steps to create a new release.
-
Update the version number in
MainApp.java
. -
Generate a JAR file using Gradle.
-
Tag the repo with the version number. e.g.
v0.1
-
Create a new release using GitHub and upload the JAR file you created.
A project often depends on third-party libraries. For example, Address Book depends on the Jackson library for XML parsing. Managing these dependencies can be automated using Gradle. For example, Gradle can download the dependencies automatically, which is better than these alternatives.
a. Include those libraries in the repo (this bloats the repo size)
b. Require developers to download those libraries manually (this creates extra work for developers)
Suggested path for new programmers:
-
First, add small local-impact (i.e. the impact of the change does not go beyond the component) enhancements to one component at a time. Some suggestions are given in this section Improving a Component.
-
Next, add a feature that touches multiple components to learn how to implement an end-to-end feature across all components. The section Creating a new command:
remark
explains how to go about adding such a feature.
Each individual exercise in this section is component-based (i.e. you would not need to modify the other components to get it to work).
💡
|
Do take a look at the Design: Logic Component section before attempting to modify the Logic component.
|
-
Add a shorthand equivalent alias for each of the individual commands. For example, besides typing
clear
, the user can also typec
to remove all persons in the list.-
Hints
-
Just like we store each individual command word constant
COMMAND_WORD
inside*Command.java
(e.g.FindCommand#COMMAND_WORD
,DeleteCommand#COMMAND_WORD
), you need a new constant for aliases as well (e.g.FindCommand#COMMAND_ALIAS
). -
AddressBookParser
is responsible for analyzing command words.
-
-
Solution
-
Modify the switch statement in
AddressBookParser#parseCommand(String)
such that both the proper command word and alias can be used to execute the same intended command. -
See this PR for the full solution.
-
-
💡
|
Do take a look at the Design: Model Component section before attempting to modify the Model component.
|
-
Add a
removeTag(Tag)
method. The specified tag will be removed from everyone in the address book.-
Hints
-
The
Model
API needs to be updated. -
Find out which of the existing API methods in
AddressBook
andPerson
classes can be used to implement the tag removal logic.AddressBook
allows you to update a person, andPerson
allows you to update the tags.
-
-
Solution
-
Add the implementation of
deleteTag(Tag)
method inModelManager
. Loop through each person, and remove thetag
from each person. -
See this PR for the full solution.
-
-
💡
|
Do take a look at the Design: UI Component section before attempting to modify the UI component.
|
-
Use different colors for different tags inside person cards. For example,
friends
tags can be all in grey, andcolleagues
tags can be all in red.Before
After
-
Hints
-
The tag labels are created inside
PersonCard#initTags(ReadOnlyPerson)
(new Label(tag.tagName)
). JavaFX’sLabel
class allows you to modify the style of each Label, such as changing its color. -
Use the .css attribute
-fx-background-color
to add a color.
-
-
Solution
-
See this PR for the full solution.
-
-
-
Modify
NewResultAvailableEvent
such thatResultDisplay
can show a different style on error (currently it shows the same regardless of errors).Before
After
-
Hints
-
NewResultAvailableEvent
is raised byCommandBox
which also knows whether the result is a success or failure, and is caught byResultDisplay
which is where we want to change the style to. -
Refer to
CommandBox
for an example on how to display an error.
-
-
Solution
-
Modify
NewResultAvailableEvent
's constructor so that users of the event can indicate whether an error has occurred. -
Modify
ResultDisplay#handleNewResultAvailableEvent(event)
to react to this event appropriately. -
See this PR for the full solution.
-
-
-
Modify the
StatusBarFooter
to show the total number of people in the address book.Before
After
-
Hints
-
StatusBarFooter.fxml
will need a newStatusBar
. Be sure to set theGridPane.columnIndex
properly for eachStatusBar
to avoid misalignment! -
StatusBarFooter
needs to initialize the status bar on application start, and to update it accordingly whenever the address book is updated.
-
-
Solution
-
Modify the constructor of
StatusBarFooter
to take in the number of persons when the application just started. -
Use
StatusBarFooter#handleAddressBookChangedEvent(AddressBookChangedEvent)
to update the number of persons whenever there are new changes to the addressbook. -
See this PR for the full solution.
-
-
💡
|
Do take a look at the Design: Storage Component section before attempting to modify the Storage component.
|
-
Add a new method
backupAddressBook(ReadOnlyAddressBook)
, so that the address book can be saved in a fixed temporary location.-
Hint
-
Add the API method in
AddressBookStorage
interface. -
Implement the logic in
StorageManager
class.
-
-
Solution
-
See this PR for the full solution.
-
-
By creating this command, you will get a chance to learn how to implement a feature end-to-end, touching all major components of the app.
Edits the remark for a person specified in the INDEX
.
Format: remark INDEX r/[REMARK]
Examples:
-
remark 1 r/Likes to drink coffee.
Edits the remark for the first person toLikes to drink coffee.
-
remark 1 r/
Removes the remark for the first person.
Let’s start by teaching the application how to parse a remark
command. We will add the logic of remark
later.
Main:
-
Add a
RemarkCommand
that extendsUndoableCommand
. Upon execution, it should just throw anException
. -
Modify
AddressBookParser
to accept aRemarkCommand
.
Tests:
-
Add
RemarkCommandTest
that tests thatexecuteUndoableCommand()
throws an Exception. -
Add new test method to
AddressBookParserTest
, which tests that typing "remark" returns an instance ofRemarkCommand
.
Let’s teach the application to parse arguments that our remark
command will accept. E.g. 1 r/Likes to drink coffee.
Main:
-
Modify
RemarkCommand
to take in anIndex
andString
and print those two parameters as the error message. -
Add
RemarkCommandParser
that knows how to parse two arguments, one index and one with prefix 'r/'. -
Modify
AddressBookParser
to use the newly implementedRemarkCommandParser
.
Tests:
-
Modify
RemarkCommandTest
to test theRemarkCommand#equals()
method. -
Add
RemarkCommandParserTest
that tests different boundary values forRemarkCommandParser
. -
Modify
AddressBookParserTest
to test that the correct command is generated according to the user input.
Let’s add a placeholder on all our PersonCard
s to display a remark for each person later.
Main:
-
Add a
Label
with any random text insidePersonListCard.fxml
. -
Add FXML annotation in
PersonCard
to tie the variable to the actual label.
Tests:
-
Modify
PersonCardHandle
so that future tests can read the contents of the remark label.
We have to properly encapsulate the remark in our ReadOnlyPerson
class. Instead of just using a String
, let’s follow the conventional class structure that the codebase already uses by adding a Remark
class.
Main:
-
Add
Remark
to model component (you can copy fromAddress
, remove the regex and change the names accordingly). -
Modify
RemarkCommand
to now take in aRemark
instead of aString
.
Tests:
-
Add test for
Remark
, to test theRemark#equals()
method.
Now we have the Remark
class, we need to actually use it inside ReadOnlyPerson
.
Main:
-
Add three methods
setRemark(Remark)
,getRemark()
andremarkProperty()
. Be sure to implement these newly created methods inPerson
, which implements theReadOnlyPerson
interface. -
You may assume that the user will not be able to use the
add
andedit
commands to modify the remarks field (i.e. the person will be created without a remark). -
Modify
SampleDataUtil
to add remarks for the sample data (delete youraddressBook.xml
so that the application will load the sample data when you launch it.)
We now have Remark
s for Person
s, but they will be gone when we exit the application. Let’s modify XmlAdaptedPerson
to include a Remark
field so that it will be saved.
Main:
-
Add a new Xml field for
Remark
. -
Be sure to modify the logic of the constructor and
toModelType()
, which handles the conversion to/fromReadOnlyPerson
.
Tests:
-
Fix
validAddressBook.xml
such that the XML tests will not fail due to a missing<remark>
element.
Our remark label in PersonCard
is still a placeholder. Let’s bring it to life by binding it with the actual remark
field.
Main:
-
Modify
PersonCard#bindListeners()
to add the binding forremark
.
Tests:
-
Modify
GuiTestAssert#assertCardDisplaysPerson(…)
so that it will compare the remark label. -
In
PersonCardTest
, callpersonWithTags.setRemark(ALICE.getRemark())
to test that changes in thePerson
's remark correctly updates the correspondingPersonCard
.
We now have everything set up… but we still can’t modify the remarks. Let’s finish it up by adding in actual logic for our remark
command.
Main:
-
Replace the logic in
RemarkCommand#execute()
(that currently just throws anException
), with the actual logic to modify the remarks of a person.
Tests:
-
Update
RemarkCommandTest
to test that theexecute()
logic works.
See this PR for the step-by-step solution.
Priorities: High (must have) - * * *
, Medium (nice to have) - * *
, Low (unlikely to have) - *
Priority | As a … | I want to … | So that I can… |
---|---|---|---|
|
new user |
see usage instructions |
refer to instructions when I forget how to use the App |
|
new user |
import existing contacts |
add contacts quickly when starting to use the App or reinstalling the App |
|
frequent user |
backup existing contacts as I add/remove them |
restore a previous version of my contacts if I make a big mistake |
|
user |
add a new person |
|
|
user |
delete a person |
remove entries that I no longer need |
|
user |
find a person by name |
locate details of persons without having to go through the entire list |
|
user |
sort persons by arrange the names in my contacts by Alphabetical order |
locate a person easily |
|
forgetful user |
have prompts for right command syntax when I enter the wrong one |
use the app more conveniently |
|
user |
arrange the names in my contacts according to first name |
locate a person easily |
|
user |
arrange the names in my contacts according to last name |
locate a person easily |
|
user |
favourite a contact |
have favorites appear at the top of search results |
|
user |
update information for any of my contacts |
not have to delete and add a contact just to change his details |
|
user |
share a contact with other people |
|
|
user |
hide private contact details by default |
minimize chance of someone else seeing them by accident |
|
forgetful user |
view my contacts' profile picture(s) |
have a picture to attach to the contact |
|
user |
alternate between using the alias and the name of my contacts |
have a nickname to attach to the person |
|
user |
view frequently contacted/searched for people at the top of the list |
|
|
lazy user |
delete multiple users at a time |
|
|
power user |
call a selected contact within 1 command after selecting the contact |
|
|
power user |
message a selected contact within 1 command after selecting the contact |
|
|
power user |
attach multiple notes to each contact |
|
|
user with many contacts |
notified when I have 2 contacts with the same name to add an alias or tag |
do not get confused by 2 contacts with the same name |
|
user with many contacts |
add multiple tags to each contact |
easily group them |
|
user |
search results to be displayed and updated every time i key in an alphabet |
search for contacts without having to finish typing in the whole name |
|
user |
arrange the names in my contacts according to their address in alphabetical order |
locate a person easily |
|
user |
view the number of contacts that I have |
|
|
user |
merge contacts |
|
|
user |
select relevant information and export to a list |
|
|
user |
access to more buttons |
have more convenience using the App |
|
user |
see the address of a selected contact on Google Maps within 1 command |
|
|
user |
link my contacts to their social media account |
|
|
user with many contacts |
have tabs for different category of contacts |
easily see who is in which group |
|
user |
customize the background colour of the application |
personalize the App. |
{More to be added}
(For all use cases below, the System is the AddressBook
and the Actor is the user
, unless specified otherwise)
MSS
-
User requests to list persons
-
AddressBook shows a list of persons
-
User requests to delete a specific person in the list
-
AddressBook deletes the person
Use case ends.
Extensions
-
2a. The list is empty.
Use case ends.
-
3a. The given index is invalid.
-
3a1. AddressBook shows an error message.
Use case resumes at step 2.
-
{More to be added}
MSS
-
User requests to sort contacts alphabetically
-
AddressBook sorts contacts alphabetically according to their names
-
AddressBook shows contact list to user
Use case ends.
Extensions
-
1a. The list is empty.
-
1a1. AddressBook shows “empty list of contacts” to user
Use case ends.
-
MSS
-
User requests to list persons
-
AddressBook shows list of persons
-
User requests to add a specific tag to a person in the list
-
AddressBook confirms the details of the instruction with the user
-
User confirms command
-
AddressBook adds tag to this person
Use case ends
Extensions
-
1a. The list is empty.
-
1a1. AddressBook shows “empty list of contacts” to user
Use case ends.
-
-
3a. User enters an invalid person on the list (out of bound of list)
-
3a1. AddressBook shows “invalid person, choose correct person (starting index to ending index)” and displays list again in background
Use case resumes at step 3.
-
-
3b. User enters unsupported character for tag
-
3b1. AddressBook shows “invalid tag name, only valid characters (display valid characters)”.
Use case resumes at step 3.
-
-
4a. User cancels command
-
4a1. AddressBook shows “command cancelled”.
Use case ends.
-
MSS
-
User requests to find contacts with a certain tag name
-
App displays all contacts with such tags
Use case ends
MSS
-
User reuqests to list all tags
-
App displays all existing tags
Use case ends
-
Should work on any mainstream OS as long as it has Java
1.8.0_60
or higher installed. -
Should be able to hold up to 1000 persons without a noticeable sluggishness in performance for typical usage.
-
A user with above average typing speed for regular English text (i.e. not code, not system admin commands) should be able to accomplish most of the tasks faster using commands than using the mouse.
-
Any command should not take longer than 1 second to execute
-
App should be able to hold at least 5000 contacts
-
Should support integration with Google contacts
-
Should support integration with Google Map for proximity services
-
App should support importing and exporting of contacts in Microsoft Excel Format
-
Support multiple instances of the app on a single device
-
Support integration with telecommunication apps such as, but not limited to, WhatsApp, Line etc.
-
Support integration with social media services and apps
{More to be added}