Project: People.connect
People.connect is a desktop address book application. This application allows users to store important information about the people they care about. It has a GUI but most of the user interactions happen using a CLI (Command Line Interface).
Code contributed: [Functional code] [Test code]
Enhancement Added: Birthday attribute
External behavior
When adding a new contact, the user can give the birthday of the contact as a parameter for the add command. Birthday can also be edited in case of mistakes.
Examples:
-
add n/John Doe p/98765432 e/johnd@example.com a/John street, block 123, #01-01 b/13/02/1998 pt/JohnDoe.jpg
Adds new contact "John Doe" with 13/02/1998 as its birthday -
edit 1 b/13/10/1992
Chooses the contact, who is listed as the first contact in the current listing and edits its birthday to be 13/10/1992
Justification
As this application is used to store important information about people, it’s highly important that the application is also capable of storing something as important as a birthday.
Birthday attribute
Person class consists of five different attributes: Name
, Address
, Phone
, Email
and Birthday
. Birthday class has a very similar implementation compared to the other attribute classes. New instance of Birthday is initialized by giving the constructor the parameter birthday in String format. The parameter is required to be non-null, and it is first validated before accepting it as a birthday value for the class.
Validation
The valid form for a birthday string is DD/MM/YYYY
, where every character must be a digit except for the slashes. This validation is performed to prohibit the user from inputting something completely peculiar, for example a string of spaces or a long sequence of characters.
Examples for a valid birthday:
-
14/12/1993
-
22/02/2001
-
29/02/2008
The date of the birthday is validated using Java’s SimpleDateFormatter class. The formatter parses user’s input and if the parsing is successful, the date is valid. The parser also accounts for leap days.
End of Extract
Loading pre-existing address book : load
Loads pre-existing address book to current address book. The pre-existing
address book has to be in xml-format and it has to be in the folder called "data"
unless defined differently in the user preferences. The file also has to have
a different name than the current address book.
Format: load FILENAME
Example:
-
load addressbook2.xml
End of Extract
Justification
In case the user has two different address books and wants to combine those address books as one, this command allows user to avoid having to type every contact’s information from the other address book manually. Also, this command allows users to conveniently share their contacts to other users by just sending their addressbook.xml file.
Load command
Load command’s implementation is similar to other commands: LoadCommand class inherits UndoableCommand and load command’s parser implements Parser interface. The following sequence diagram shows the execution of command "load testbook.xml"
End of Extract
Informing about the birthdays
Coming in v2.0
When the application is started, it opens a pop-up window to show the
persons that are having a birthday on that day. Also, when adding a new
contact or loading new contacts from a pre-existing address book,
the user would be informed if some of the new contacts were having a birthday.
End of Extract
Justification
Now that the application is capable of storing birthdays, a natural and useful feature to implement next would be to inform the user if his contacts are having a birthday.