PROJECT: AddressBook - Level 4


Overview

NSync was designed to streamline the average NUS student’s life by automating notes downloads and aiding in meeting scheduling by automating the search for common free time slots between contacts. NSync is a desktop application that uses a command line interface.

Summary of contributions

  • Major enhancement: Schedule synchronizer.

    • What it does: It allows a user to store timetables in the address book. Group contacts with a merged timetable can be created from multiple contacts. Group contacts can be automatically updated when any timetable changes or deletions are made. update.

    • Justification: This will allow users to easily find a time slot to arrange for meet ups for social or work related reasons because finding a common time slot can be an annoying experience when it involves too many people. It also ensures that keeping it updated is not a hassle.

    • Highlights: The implementation of the timetable had 2 major hurdles. First was finding a way for the timetable to be properly displayed on the UI. This required a lot of trial and error to get the timetable to be displayed in the way I envisioned it. Secondly, storing the timetable was an interesting and educational experience. Because the timetable is essentially a map of lists of time slots, when it gets converted to XML format, the values inside the list actually are lost. This issue led to me learning that a class needed to be created to wrap the list so it could store properly.

  • Minor enhancement:

    • Contacts can be filtered based on their free time slots or activities present in their timetable or enrolled modules that they have.

  • Code contributed: [Functional and test code]

  • Other contributions:

    • Project management:

      • Bug reports of NSync reviewed and commented on and fixed those relevant to me: All issues from #99 to #135

    • Enhancements to existing features:

      • Adjusted the UI to display timetables for each contact and have separate lists for group contacts, individual contacts and self contact.

      • Edited delete and find functions to be able to be able to select which list, merged or main, to delete or find from.

    • Community:

      • Reported bugs and suggestions for team T16-3 in the class: #111, #118, #120, #124, #126

Contributions to the User Guide

Given below are sections I contributed to the User Guide. They showcase my ability to write documentation targeting end-users.

Changing Time Slots: change

You can change your own, or a contact’s timetable to reflect whether there is an activity at a specified time slot, or whether it is free or busy.

Format: change INDEX/SELF DAY TIME ACTIVITY/FREE/BUSY

  • Changes the timetable of the person specified by index or your own timetable if self is inputted.

  • The DAY refers to which day of the timetable is going to be edited.

  • The TIME refers to which time within the day will be edited.

  • The ACTIVITY/FREE/BUSY refers to what will be reflected at the seleted time slot

  • DAY must be mon, tue, wed, thu or fri (Non-case sensitive)

  • TIME must be 8am, 9am, 10am, 11am, 12pm, 1pm, 2pm, 3pm, 4pm, 5pm, 6pm, 7pm

change 1 mon 8am GER1000 Changes the mon 8am time slot of the first contact in the main contact list to GER1000

Before:

ChangeCommand1

After:

ChangeCommand2

Merging timetables: merge

You can select multiple contacts whose timetables you would like to merge and give it a group name. This displays a collated timetable with the number of people busy for each time slot. It also displays the names of the people in the group.

Format: merge m/INDEX m/INDEX…​

  • Merges the people at selected INDEXes.

  • The index refers to the index number shown in the displayed person list.

  • The index must be a positive integer 1, 2, 3, …​

  • More than 2 people can be merged at once

  • Your own timetable wil always be included in the merge

  • You may select one contat multiple times if they are deemed more important to the group

merge m/2 m/3 m/4 n/CS2101 Project
Merges your own timetable with the 2nd, 3rd and 4th people in the address book.

MergeCommandUserGuide

The merged timetable will be added to the list of groups

Filters contacts based on free time slots and activities: filter

You can select a time slot or activity you would like to filter your contacts by. Time slot filtering filters out people who are busy at the selected time slot. Activity filtering filters out people who do not have the activity in their timetable or does not have the module in their enrolled modules if the activity is a module taken.

Format: filter ACTIVITY /DAY TIME…​

  • Entering a module code removes contacts without the module from the list.

  • Entering a day and time removes contacts without that time slot free.

  • Day must be mon, tue, wed, thu or fri.

  • Only inputs after a valid day will be treated as a time. Every other input gets treated as an activity.

  • Time must be 8am, 9am, 10am, 11am, 12am, 1pm, 2pm, 3pm, 4pm, 5pm, 6pm or 7pm.

  • Contacts can be filtered by more than one activity/day and time.

  • Filter feature is not case sensitive.

filter GER1000
Shows only contacts who have GER1000 in the timetable.

filter run
Shows only contacts who have run in their timetable.

filter mon 10am
Shows only contacts who are free at mon 10am.

filter GER1000 mon 10 am
Shows only contacts who have GER1000 in their timetable and are free at mon 10am.

Updating group timetables: update

You can automatically update your group timetables based on whatever changes have been made to your contacts' timetables.

Format: update

  • Update will update all your groups when you use it.

  • If a contact who belongs in one of your groups is deleted, update will show who was deleted and which groups were affeccted in addition to updating the group timetables.

  • If the deletion of a contact results in your own contact being the only person left in the group, the group will be automatically deleted. This deletion will also be reflected in the command result in addition to the people who were deleted and the groups affected by their deletion.

Contributions to the Developer Guide

Given below are sections I contributed to the Developer Guide. They showcase my ability to write technical documentation and the technical depth of my contributions to the project.

Change Time Slot Feature

Current Implementation

The change time slot feature allows users to edit the timetables of the contacts in their address book. The user inputs the index of the contact whose timetable they would like to edit, the day and time of the time slot they want to edit, and the activity they would like to put in that time slot.

Given below is an example a usage scenario and how the change mechanism behaves at each step.

Step 1. The user inputs the index, day, time and activity. The ChangeTimeSlotCommandParser puts them into an array activities and checks to ensure that all the inputs are present and the inputs are in the correct format. Any incorrectly formatted input will result in a ParseException being thrown. It then calls the ChangeTimeSlotCommand with the first element of activities as the index and activities as arguments.

ChangeTimeslot1

Step 2. The ChangeTimeSlotCommand uses the index to get the Person, personToChange whose timetable is supposed to be changed. It then calls createNewUpdatedTimetable with the timetable of personToChange copy of their timetable is made. This method iterates through activities and gets the day time and activity by checking their position in the array. The time slot to be changed is retrieved based on the selected Person, day and time. It then checks to see if the activity at the selected time slot is the same as the one it is supposed to be changed to. If it is, it is ignored. If it is not, the time slot in the copied timetable is changed and a Boolean variable didTimetableChange is set to true.

ChangeTimeslot2

Step 3. Once activities has been fully iterated through, a new Person newPerson is created with all the same identity fields of personToChange, except for the timetable which is the changed timetable.

ChangeTimeslot3

Step 4. newPerson replaces personToChange in the AddressBook.

ChangeTimeslot4

The following sequence diagram shows how the change function works.

ChangeTimeSlot5

Design Considerations

Aspect: How change executes
  • Alternative 1 (current choice): Create a copy of the timetable to change and then create a new Person with the same identity fields as the person to change with the changed timetable and replacing the person to change with this new Person.

    • Pros: Prevents a bugs caused by user inputting the same change to a time slot twice in the same input which results in the application stating that no time slot was changed even though a time slot is changed.

    • Cons: Takes more processes making it a little slower.

  • Alternative 2 : Directly change the timetable of the person to change.

    • Pros: Takes less processes making it a little faster.

    • Cons: Might result in aforementioned bug.

Merge Timetable Feature

Current Implementation

The merge feature allows for users to select multiple contacts and outputs a merged timetable with all their common free slots. When the user inputs the indexes of the contacts he wants to merge, the Person(s) are stored in an array , personsToMerge. The array is then iterated through, merging the all objects inside and outputting a final Person to be added to the address book.

Given below is an example usage scenario and how the merge mechanism behaves at each step.

Step 1. The user selects the indexes of the contacts he wants to merge and inputs a group name. MergeCommandParser takes the indexes and puts it in a list. It then calls MergeCommand with the list and the group name as arguments. The Merge Command uses the list of indexes and the filteredPersonsList to create and fill the array personsToMerge. Your own contact, Person with "self" Tag is always added to the array.

MergeCommand1

Step 2. The mergeTimetable function is called on each Person in personsToMerge and the element after it. The merge Timetable function iterates through all the time slots in both timetables and creates a new time table based on them.

MergeCommand4

Step 3. The Name`s of each `Person are appended together and gets saved in the Address of the merged Person. The merged timetable and a "merged" Tag are added to the merged Person. The merged Person is also given a placeholder Email and Phone. "merged" Tag causes these Persons(s) to be displayed in a separate list in the UI.

MergeCommand3

Step 4. When personsToMerge is fully iterated through, the last Person inside is added to the address book. If there already exists a Person with the same Name, that Person is updated and a CommandResult reflecting this is shown.

MergeCommand5

The following sequence diagram shows how the merge function works.

MergeCommand6

Design Considerations

Aspect: How merge executes
  • Alternative 1 (current choice): Uses a "merged" Tag to differentiate between merged and normal contacts. The merged contacts are displayed in a separate part of the UI with the placeholder Email and Phone undisplayed. Address is used to display the names of all the Person`s merged together to create the merged `Person.

    • Pros: Easier to implement since it does not require creating a new Class.

    • Cons: Violates SOC principles because now Address is used both to store addresses and names. This could lead to potential bugs if Address is changed to have different requirements to be considered valid.

  • Alternative 2 (To be implemented in V2): Have a specific Class that has timetable and name that is updated with the merged timetable and names of people being merged.

    • Pros: Better follows Separation of Concerns Principle.

    • Cons: Requires more time to implement.

UI Class Diagram

UiDeveloperGuide