Skip to content

Latest commit

 

History

History
1489 lines (1080 loc) · 66.8 KB

DeveloperGuide.adoc

File metadata and controls

1489 lines (1080 loc) · 66.8 KB

Cow - Developer Guide

By: Team T09-1      Since: Aug 2018      Licence: MIT

1. Setting up

1.1. Prerequisites

  1. JDK 9 or later

    ⚠️
    JDK 10 on Windows will fail to run tests in headless mode due to a JavaFX bug. Windows developers are highly recommended to use JDK 9.
  2. IntelliJ IDE

    ℹ️
    IntelliJ by default has Gradle and JavaFx plugins installed.
    Do not disable them. If you have disabled them, go to File > Settings > Plugins to re-enable them.

1.2. Setting up the project in your computer

  1. Fork this repo, and clone the fork to your computer

  2. Open IntelliJ (if you are not in the welcome screen, click File > Close Project to close the existing project dialog first)

  3. Set up the correct JDK version for Gradle

    1. Click Configure > Project Defaults > Project Structure

    2. Click New…​ and find the directory of the JDK

  4. Click Import Project

  5. Locate the build.gradle file and select it. Click OK

  6. Click Open as Project

  7. Click OK to accept the default settings

  8. Open a console and run the command gradlew processResources (Mac/Linux: ./gradlew processResources). It should finish with the BUILD SUCCESSFUL message.
    This will generate all resources required by the application and tests.

  9. Open XmlAdaptedPerson.java and MainWindow.java and check for any code errors

    1. Due to an ongoing issue with some of the newer versions of IntelliJ, code errors may be detected even if the project can be built and run successfully

    2. To resolve this, place your cursor over any of the code section highlighted in red. Press ALT+ENTER, and select Add '--add-modules=…​' to module compiler options for each error

  10. Repeat this for the test folder as well (e.g. check XmlUtilTest.java and HelpWindowTest.java for code errors, and if so, resolve it the same way)

1.3. Verifying the setup

  1. Run the seedu.address.MainApp and try a few commands

  2. Run the tests to ensure they all pass.

1.4. Configurations to do before writing code

1.4.1. Configuring the coding style

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,

  1. Go to File > Settings…​ (Windows/Linux), or IntelliJ IDEA > Preferences…​ (macOS)

  2. Select Editor > Code Style > Java

  3. Click on the Imports tab to set the order

    • For Class count to use import with '*' and Names count to use static import with '*': Set to 999 to prevent IntelliJ from contracting the import statements

    • For Import Layout: The order is import static all other imports, import java.*, import javax.*, import org.*, import com.*, import all other imports. Add a <blank line> between each import

Optionally, you can follow the UsingCheckstyle.adoc document to configure IntelliJ to check style-compliance as you write code.

1.4.2. Setting up CI

Set up Travis to perform Continuous Integration (CI) for your fork. See UsingTravis.adoc to learn how to set it up.

After setting up Travis, you can optionally set up coverage reporting for your team fork (see UsingCoveralls.adoc).

ℹ️
Coverage reporting could be useful for a team repository that hosts the final version but it is not that useful for your personal fork.

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)

2. Design

2.1. Architecture

Architecture
Figure 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.

  • 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.

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 it’s API in the Logic.java interface and exposes its functionality using the LogicManager.java class.

LogicClassDiagram
Figure 2. Class Diagram of the Logic Component

Events-Driven nature of the design

The Sequence Diagram below shows how the components interact for the scenario where the user issues the command delete 1.

SDforDeletePerson
Figure 3. 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.

SDforDeletePersonEventHandling
Figure 4. 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.

2.2. UI component

UiClassDiagram
Figure 5. 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, StatusBarFooter, 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

Additionally, the CalendarPanel consists of CalendarHeaderCell to indicate days of week, CalendarContentCell to indicate the date, and CalendarTaskCard for each of the tasks that falls on that date

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 the Model change.

  • Responds to events raised from various parts of the App and updates the UI accordingly.

2.3. Logic component

LogicClassDiagram
Figure 6. Structure of the Logic Component

API : Logic.java

  1. Logic uses the AppParser class to parse the user command.

  2. AppParser then sends the command to the appropriate module parser.

  3. This results in a Command object which is executed by the LogicManager.

  4. The command execution can affect the Model (e.g. adding a person) and/or raise events.

  5. The result of the command execution is encapsulated as a CommandResult object which is passed back to the Ui.

Given below is the Sequence Diagram for interactions within the Logic component for the execute("contacts delete 1") API call.

DeletePersonSdForLogic
Figure 7. Interactions Inside the Logic Component for the contacts delete 1 Command

2.4. Model component

ModelClassDiagram
Figure 8. Structure of the Model Component

API : Model.java

The Model,

  • stores a UserPref object that represents the user’s preferences.

  • stores Person and Task data.

  • exposes an unmodifiable ObservableList<Person> and ObservableList<Task> 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.

2.5. Storage component

StorageClassDiagram
Figure 9. 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.

ℹ️
XmlAdaptedPerson depends on XmlAdaptedTaskId to keep track of tasks assigned to the person.
XmlAdaptedTask depends on XmlAdaptedPersonId to keep track of persons assigned to the task.

2.6. Common classes

Classes used by multiple components are in the seedu.addressbook.commons package.

3. Implementation

This section describes some noteworthy details on how certain features are implemented.

3.1. Task class

TaskComponentClassDiagram
Figure 10. Structure of the Task class

The Task class consists of list of Tag objects and a Name object, corresponding to the same classes in the Person namespace. It also has two DateTime objects, one for the start date and time and the other for the end date and time of the task.

The DateTime class encapsulates a Java Calendar object to store a date and time. It also includes methods to parse and validate date/time inputs from the user, and methods to return the date or time as a String.

3.2. Addition of tasks

Adding a task is fairly straightforward. The user command is given to the parser, which validates the input and creates the task and the objects it is associated with. One aspect with a more involved implementation is the accomodation of optional start date and time fields in the user input, which is illustrated here.

AddTaskSequenceDiagram
Figure 11. Interactions for derivation of start date and time from optional input in AddCommandParser
  1. The AddCommandParser receives the input string and calls ArgumentTokenizer.tokenize() to create an ArgumentMultiMap.

  2. It then creates a Date object for the current moment in time and uses the INPUT_DATE_FORMAT and INPUT_TIME_FORMAT DateFormat s in DateTime to parse the Date object into date and time strings in the correct format.

  3. It then retrieves the start date and start time strings from argMultiMap, which returns an Optional<String> for each of them.

  4. orElse() is then called on each Optional<String> to obtain the string encapsulated by the Optional, or the string for the current date/time if the Optional is empty.

  5. Finally, ParserUtil.parseDateTime() is called with the resultant date and time strings.

3.3. Listing and finding of tasks

3.3.1. Current Implementation

Listing and finding of tasks is facilitated by ModelManager and displayed through TaskListPanel.

ModelManager implements the following relevant methods:

  • ModelManager#updateFilteredTaskList(Predicate<Task> predicate) — Updates the the internal filteredTasks list with the predicate given. Exposed through the Model interface.

  • ModelManager#getFilteredTaskList() — Returns an unmodifiable view of the internal filteredTasks list that updates with any changes to the baselist. Exposed through the Logic and Model interfaces.

ℹ️
ModelManager#filteredTasks is a JavaFX FilteredList around the unmodifiable list of tasks provided by VersionedAddressBook#getTaskList()).

TaskListPanel is constructed with the JavaFX ObservableList returned by ModelManager#getFilteredTaskList() when the application is started and displays it.

To find specific tasks, the appropriate predicate is passed into ModelManager#updateFilteredTaskList(), which updates the filteredTasks list, propagating the change up to the TaskListPanel display.

TaskListFindModelSequenceDiagram
Figure 12. Filtering of Tasks in Model Component

Currently, there are 2 use cases where ModelManager#updateFilteredTaskList() is called, examples are given below.

Case 1: On application startup or after running tasks list command

ModelManager#updateFilteredTaskList() is called with Model#PREDICATE_SHOW_ALL_TASKS which returns true for all tasks.

TaskListLogicSequenceDiagram
Figure 13. Sequence Diagram of Tasks List Command

Case 2: After running tasks find [n/KEYWORD]…​ [sd/START_DATE] [ed/END_DATE] [t/TAG]… command

ModelManager#updateFilteredTaskList() is called with predicate built by TaskPredicateAssembler which combines the different predicates from input.

ℹ️

TaskPredicateAssembler combines the following predicates:

  • NameContainsKeywordsPredicate: Returns true if tasks name contains any of the full keywords

  • MatchesStartDatePredicate: Returns true if start date of task matches input

  • MatchesEndDatePredicate: Returns true if end date of task matches input

  • HasTagsPredicate: Returns true if task contains any of the specified tags

TaskFindLogicSequenceDiagram
Figure 14. Sequence Diagram of Tasks Find Command

3.3.2. Design Considerations

Aspect: Updating of UI when list is filtered
  • Alternative 1 (current choice): Using ObservableList and ListView from JavaFX in UI component.

    • Pros:

      • Automatically updates ListView when changes are made to ObservableList, no manual events are needed.

      • Addition, updates and deletion of tasks will only need to interface with Logic and Model.

    • Cons:

      • ObservableList does not raise change events when tasks in the base list are mutated. Any edits to existing tasks will need to replace the old Task instance with a new one for changes to be reflected on the UI.

  • Alternative 2: Using Java List in UI component.

    • Pros:

      • Does not enforce immutability on tasks.

      • Full control over when and what UI should update.

    • Cons:

      • Events will need to be raised manually when tasks are changed.

Aspect: Filtering of lists
  • Alternative 1 (current choice): Using FilteredList from JavaFX.

    • Pros:

      • Convenient as the filter is maintained even when the base list is changed.

      • Abstracts away filtering logic, only need to be concerned with the predicate used.

      • Any filter updates will automatically update UI as it implements ObservableList.

    • Cons:

      • Only works as a simple filter.

  • Alternative 2: Using Streams from Java.

    • Pros:

      • Powerful, can also be used to transform tasks as an intermediate operation.

    • Cons:

      • For the same predicate, a new stream will need to be made when the task list is changed.

      • Events will need to be raised to update UI on newly filtered list of tasks.

3.3.3. Future Enhancements

Currently, searching by task name only matches full keywords. In the future, part of words can be matched to allow users to search with incomplete keywords.

3.4. Undo/Redo feature

3.4.1. Current Implementation

The undo/redo mechanism is facilitated by VersionedAddressBook. It extends AddressBook with an undo/redo history, stored internally as an addressBookStateList and currentStatePointer. Additionally, it implements the following operations:

  • VersionedAddressBook#commit() — Saves the current address book state in its history.

  • VersionedAddressBook#undo() — Restores the previous address book state from its history.

  • VersionedAddressBook#redo() — Restores a previously undone address book state from its history.

These operations are exposed in the Model interface as Model#commitAddressBook(), Model#undoAddressBook() and Model#redoAddressBook() respectively.

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 VersionedAddressBook will be initialized with the initial address book state, and the currentStatePointer pointing to that single address book state.

UndoRedoStartingStateListDiagram

Step 2. The user executes delete 5 command to delete the 5th person in the address book. The delete command calls Model#commitAddressBook(), causing the modified state of the address book after the delete 5 command executes to be saved in the addressBookStateList, and the currentStatePointer is shifted to the newly inserted address book state.

UndoRedoNewCommand1StateListDiagram

Step 3. The user executes add n/David …​ to add a new person. The add command also calls Model#commitAddressBook(), causing another modified address book state to be saved into the addressBookStateList.

UndoRedoNewCommand2StateListDiagram
ℹ️
If a command fails its execution, it will not call Model#commitAddressBook(), so the address book state will not be saved into the addressBookStateList.

Step 4. The user now decides that adding the person was a mistake, and decides to undo that action by executing the undo command. The undo command will call Model#undoAddressBook(), which will shift the currentStatePointer once to the left, pointing it to the previous address book state, and restores the address book to that state.

UndoRedoExecuteUndoStateListDiagram
ℹ️
If the currentStatePointer is at index 0, pointing to the initial address book state, then there are no previous address book states to restore. The undo command uses Model#canUndoAddressBook() to check if this is the case. If so, it will return an error to the user rather than attempting to perform the undo.

The following sequence diagram shows how the undo operation works:

UndoRedoSequenceDiagram

The redo command does the opposite — it calls Model#redoAddressBook(), which shifts the currentStatePointer once to the right, pointing to the previously undone state, and restores the address book to that state.

ℹ️
If the currentStatePointer is at index addressBookStateList.size() - 1, pointing to the latest address book state, then there are no undone address book 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#commitAddressBook(), Model#undoAddressBook() or Model#redoAddressBook(). Thus, the addressBookStateList remains unchanged.

UndoRedoNewCommand3StateListDiagram

Step 6. The user executes clear, which calls Model#commitAddressBook(). Since the currentStatePointer is not pointing at the end of the addressBookStateList, all address book states after the currentStatePointer will be purged. We designed it this way because it no longer makes sense to redo the add n/David …​ command. This is the behavior that most modern desktop applications follow.

UndoRedoNewCommand4StateListDiagram

The following activity diagram summarizes what happens when a user executes a new command:

UndoRedoActivityDiagram

3.4.2. Design Considerations

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: Data structure to support the undo/redo commands
  • Alternative 1 (current choice): Use a list to store the history of address book states.

    • Pros: Easy 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 VersionedAddressBook.

  • Alternative 2: Use HistoryManager for undo/redo

    • Pros: We do not need to maintain a separate list, 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.

3.5. Calendar show feature

3.5.1. Current Implementation

The calendar show feature is facilitated by the ModelManager and displayed through the CalendarPanel. The purpose of this feature is to allow the user to more easily view his tasks.

This feature can be broken down into two stages: updating the model based on user input and rendering the UI.

Stage 1: Input handling

The following operation is exposed via the Model interface:

  • Model#updateCalendarMonth() — Saves the given calendar that encapsulates the month to be displayed in the calendar panel.

The basic flow of the calendar show command is as such:

Step 1. The user enters the command calendar show y/2018 m/12

Step 2. The command is parsed and a ShowCommand object is created with the appropate values for year and month.

Step 3. The ShowCommand#execute() method is invoked, and Model#updateCalendarMont() is called with a Calendar object encapsulating the first day of the specified month 1 Dec 2018.

ℹ️
The date of the month is arbitrarily chosen. However this is not strictly necessary as the necessary processing will be done by the UI component when rendering the calendar.

This is summarised in the following image.

CalendarShowCommandSequence
Figure 15. Calendar Show Command Logic Sequence Diagram
Stage 2: UI Rendering

The following operation is exposed via the Model interface:

  • Model#getCalendarMonth() — Returns an ObservableValue<Calendar> for the calendar UI elements to determine the month to display and the weekday it starts on.

Given below is how the calendar UI is initialised.

Step 1. The user launches the application. The Model is initialised with a ObservableValue<Calendar> representing the current date. The MainWindow class calls Model#getCalendarMonth() and Model#getFilteredTaskList() when creating the CalendarPanel. This initialises the CalendarPanel with an ObservableList<Task> and ObservableValue<Calendar> to allow it to perform UI updates when necessary.

Step 2. The CalendarPanel constructs a GridPane and sets the row and column constraints.

Step 3. The CalendarPanel populates the GridPane. The cells in the header row are populated with CalendarHeaderCell elements containing the days of a week. All other cells are populated with CalendarContentCell elements based on its position in the grid. The CalendarContentCell elements are intialised with the ObservableList<Task> and ObservableValue<Calendar>.

Step 4. The CalendarContentCell computes the date that it represents based on the calendar it receives and its position in the grid. It then creates a FilteredList<Task> from the ObservableList<Task> that only contains tasks belonging to that state. Finally, the ListView<Task> element configured to display elements in the FilteredList<Task> with CalendarTaskCard elements.

Step 5. The CalendarContentCell listens to updates to the ObservableValue<Calendar> that would update the predicate for the FilteredList<Task>.

Step 6. The CalendarPanel writes the header for the month and year it is displaying.

Step 7. The CalendarPanel listens to updates to the ObservableValue<Calendar> that would update the calendar header with the month and year of the new value.

Initialisation complete.

Given below is how calendar show command is handled by the UI components.

Step 1. The user enters calendar show y/2018 m/1. This causes Model#updateCalendarMonth to called, which sets the new value for the ObservableValue<Calendar>.

Step 2. The update to the ObservableValue<Calendar> triggers the listener registered by the CalendarPanel. This causes the calendar header to be updated via CalendarPanel#handleUpdateCalendar.

Step 3. The update to the ObservableValue<Calendar> triggers the listener registered by the CalendarContentCell. This causes it to recompute the date that it represents and update the predicate for its FilteredList<Task>. This causes cell to display the appropriate tasks based on the new designated month.

Update complete.

The image below summarises the abovementioned mechanism for a single cell in the calendar.

CalendarRenderSequence
Figure 16. Calendar UI Rendering Sequence Diagram

3.5.2. Design Considerations

Aspect: Where to filter tasks by month for displaying in the calendar.
  • Alternative 1 (current choice): Calendar object representing current month and full task list passed to calendar pane, all filter operations done in the calendar pane.

    • Pros:

      • Less data duplication.

      • Allows effect of task filtering via the CLI to also be visible in the calendar view.

      • Allows display of tasks in adjacent months.

    • Cons:

      • Slightly less efficient since each cell needs to filter the entire task list.

  • Alternative 1: Done in the model

    • Pros:

      • Application logic does not reside in the view layer.

    • Cons:

      • Repeated filtering at multiple steps.

      • Task data is duplicated in multiple places.

      • Difficult to display events from adjacent months.

Aspect: Construction of grid cell.
  • Alternative 1 (current choice): Cells are constructed once and contents are updated each time the month is changed

    • Pros:

      • Better performance: Deleting and recreating elements incurs some computational cost.

      • Cleaner abstraction: Code better follows Single Responsibility Principle. Updating of predicate for a FilteredList<Task> more accurately represents the actual behaviour being modelled.

    • Cons:

      • Increased complexity of implementation.

  • Alternative 2: Delete and regenerate cell contents each time the month is changed

    • Pros:

      • Ease of implementation.

    • Cons:

      • Poorer performance.

      • Messy code. One huge class will be used for the entire calendar.

3.6. Logging

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 Section 3.7, “Configuration”)

  • The Logger for a class can be obtained using LogsCenter.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

3.7. Configuration

Certain properties of the application can be controlled (e.g App name, logging level) through the configuration file (default: config.json).

3.8. Editing and Batch Deleting Tasks

3.8.1. Current implementation

The code for editing and deleting tasks is actually pretty similar to how it is implemented for persons. This is a combination of adding support for two additional commands: tasks edit and tasks delete inside TasksParser, defining the parser classes EditCommandParser and DeleteCommandParser, and the command classes EditCommand and DeleteCommand, and finally, adding void updateTask(Task target, Task editedTask); and void deleteTask(Task target); in the Model interface, and implementing them in the ModelManager class.

As for validation, in EditCommandParser, user input will be checked whether they conform to the format, else ParseException is thrown and usage message will be shown to the user. Meanwhile, EditCommand does another kind of validation: that the start date and time are before the end date and time, else CommandException is thrown and the user will be informed to ensure the chronological order of start and end DateTime. All these validations are done using methods defined inside DateTime.

To explain more clearly, you can see below a sequence diagram of what happens when the user asks the program to edit a task:

EditTaskSequenceDiagram
Figure 17. Sequence Diagram of tasks edit Command in the Logic Component
EditTaskModelSequenceDiagram
Figure 18. Sequence Diagram of tasks edit Command in the Model Component

Please do note that DeleteCommand for Task is different from that of Person in that the former actually takes in a list of indices to be deleted, which is required to support batch deleting tasks. Changes are also made in DeleteCommandParser to add support for multiple indices user input, and to recognise the keyword "all". Should the keyword "all" be encountered, the list passed to DeleteCommand is null, which is a special value to indicate to DeleteCommand to delete all tasks in the current displayed list. You can find below the sequence diagram for batch-deleting task(s).

DeleteTaskModelSequenceDiagram
Figure 19. Sequence Diagram of tasks delete Command in the Logic Component
DeleteTaskSequenceDiagram
Figure 20. Sequence Diagram of tasks delete Command in the Model Component
💡
These diagrams are generated using PlantUML. The files used to generate the image files are stored inside docs/plantuml.

Note the AddressBookChangedEvent that is raised — this will notify StorageManager that there is a change in the AddressBook, and so to save to disk.

3.8.2. Future Enhancements

Currently, the methods void updateTask(Task target, Task editedTask) and void updatePerson(Person target, Person editedPerson) in the Model interface are very similar. Perhaps in the future Model can be refactored as a generic so that there is minimum code duplication.

3.9. Assigning and unassigning tasks and contacts

3.9.1. Current implementation

Tasks and contacts can be assigned to each other using the commands tasks assign and contacts assign, and unassigned by the tasks unassign and contacts unassign commands.

This many-to-many relationship is stored as a list of task IDs and person IDs in the Person and Task classes respectively. The IDs are UUIDs, chosen because they are guaranteed to be globally unique and are not dependent on the IDs of other tasks and persons. The IDs are generated randomly by the Person and Task classes if they are not provided to their respective constructors.

The commands are parsed by AssignCommandParser and UnassignCommandParser, which are used by both TasksParser and ContactsParser. Both parsers will execute their respective AssignCommand and UnassignCommand. If both the specified task and contact are found, the task and person IDs will be added to Person.taskIds and Task.personIds respectively, and the edited objects will be saved to disk. As happens when the edit commands are run, indicateAddressBookChanged() is called to update the UI. The data flow is similar to the one for EditCommand in the previous section.

The figure below is a sequence diagram that illustrates what happens when the user assigns a contact to a task. The process for assigning tasks to contacts and the unassign process are both very similar to this.

AssignTaskSequenceDiagram
Figure 21. Sequence Diagram of Task Assign Command
💡
These diagrams are generated using PlantUML. The files used to generate the image files can be found in docs/diagrams/plantuml.

3.9.2. Error handling

AssignCommand will also throw errors if a user tries to assign a task to a contact when the contact has already been assigned. Although this is not strictly necessary as the IDs are stored in sets and it would have been impossible to assign someone twice, the error message assures the user that no double assignments will be made, and thus improves the user experience. Similarly, UnassignCommand throws errors if the user attempts to unassign a contact from a task when the contact is not assigned to it.

3.9.3. Alternative implementations considered

An alternative implementation that was considered was to model the many-to-many relationship using an Assignment class, which will act like a join table in relational databases. This would have slightly decoupled the Person and Task classes. However, we chose not to implement it this way as a Person will always be assigned to a Task, and also because implementing such a relationship with manually managed IDs is extremely complex without a relational database to abstract away the complexity.

3.9.4. Future Enhancements

Both AssignCommand and UnassignCommand have nearly identical implementations for both tasks and contacts. This is intentional, as this leaves room for the implementation of task or contact specific features. An example of such a possibility is an unassign all feature, e.g. contacts unassign c/3, which will be able to unassign contact 3 from all his tasks.

4. Documentation

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.

4.1. Editing Documentation

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.

4.2. Publishing Documentation

See UsingTravis.adoc to learn how to deploy GitHub Pages using Travis.

4.3. Converting Documentation to PDF format

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.

  1. Follow the instructions in UsingGradle.adoc to convert the AsciiDoc files in the docs/ directory to HTML format.

  2. Go to your generated HTML files in the build/docs folder, right click on them and select Open withGoogle Chrome.

  3. Within Chrome, click on the Print option in Chrome’s menu.

  4. Set the destination to Save as PDF, then click Save to save a copy of the file in PDF format. For best results, use the settings indicated in the screenshot below.

chrome save as pdf
Figure 22. Saving documentation as PDF files in Chrome

4.4. Site-wide Documentation Settings

The build.gradle file specifies some project-specific asciidoc attributes which affects how all documentation files within this project are rendered.

💡
Attributes left unset in the build.gradle file will use their default value, if any.
Table 1. List of site-wide attributes
Attribute name Description Default value

site-name

The name of the website. If set, the name will be displayed near the top of the page.

not set

site-githuburl

URL to the site’s repository on GitHub. Setting this will add a "View on GitHub" link in the navigation bar.

not set

site-seedu

Define this attribute if the project is an official SE-EDU project. This will render the SE-EDU navigation bar at the top of the page, and add some SE-EDU-specific navigation items.

not set

4.5. Per-file Documentation Settings

Each .adoc file may also specify some file-specific asciidoc attributes which affects how the file is rendered.

Asciidoctor’s built-in attributes may be specified and used as well.

💡
Attributes left unset in .adoc files will use their default value, if any.
Table 2. List of per-file attributes, excluding Asciidoctor’s built-in attributes
Attribute name Description Default value

site-section

Site section that the document belongs to. This will cause the associated item in the navigation bar to be highlighted. One of: UserGuide, DeveloperGuide, LearningOutcomes*, AboutUs, ContactUs

* Official SE-EDU projects only

not set

no-site-header

Set this attribute to remove the site navigation bar.

not set

4.6. Site Template

The files in docs/stylesheets are the CSS stylesheets of the site. You can modify them to change some properties of the site’s design.

The files in docs/templates controls the rendering of .adoc files into HTML5. These template files are written in a mixture of Ruby and Slim.

⚠️

Modifying the template files in docs/templates requires some knowledge and experience with Ruby and Asciidoctor’s API. You should only modify them if you need greater control over the site’s layout than what stylesheets can provide. The SE-EDU team does not provide support for modified template files.

5. Testing

5.1. Running Tests

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 choose Run '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)

5.2. Types of tests

We have two types of tests:

  1. GUI Tests - These are tests involving the GUI. They include,

    1. System Tests that test the entire App by simulating user actions on the GUI. These are in the systemtests package.

    2. Unit tests that test the individual components. These are in seedu.address.ui package.

  2. Non-GUI Tests - These are tests not involving the GUI. They include,

    1. Unit tests targeting the lowest level methods/classes.
      e.g. seedu.address.commons.StringUtilTest

    2. 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

    3. 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

5.3. Troubleshooting Testing

Problem: HelpWindowTest fails with a NullPointerException.

  • Reason: One of its dependencies, HelpWindow.html in src/main/resources/docs is missing.

  • Solution: Execute Gradle task processResources.

6. Dev Ops

6.1. Build Automation

See UsingGradle.adoc to learn how to use Gradle for build automation.

6.2. Continuous Integration

We use Travis CI and AppVeyor to perform Continuous Integration on our projects. See UsingTravis.adoc and UsingAppVeyor.adoc for more details.

6.3. Coverage Reporting

We use Coveralls to track the code coverage of our projects. See UsingCoveralls.adoc for more details.

6.4. Documentation Previews

When a pull request has changes to asciidoc files, you can use Netlify to see a preview of how the HTML version of those asciidoc files will look like when the pull request is merged. See UsingNetlify.adoc for more details.

6.5. Making a Release

Here are the steps to create a new release.

  1. Update the version number in MainApp.java.

  2. Generate a JAR file using Gradle.

  3. Tag the repo with the version number. e.g. v0.1

  4. Create a new release using GitHub and upload the JAR file you created.

6.6. Managing Dependencies

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)

Appendix A: Product Scope

Target User: NUS Computing students doing group projects

Target user profile: - is a student managing a project with multiple team members - has a need to manage a significant number of contacts - has a need to manage a significant number of tasks - prefer desktop apps over other types - can type fast - prefers typing over mouse input - is reasonably comfortable using CLI apps

Value proposition: manage tasks faster than a typical mouse/GUI driven app

Appendix B: User Stories

Priorities: High (must have) - * * , Medium (nice to have) - , Low (unlikely to have) -

Priority As a… I want to… So that I can…

* * *

user

CRUD Tasks

* * *

project manager

assign other tasks to people

track who’s supposed to complete them and notify them that they are supposed to complete the task

* * *

project manager

see the tasks assigned to each person

know what they’re supposed to do

* * *

project manager

see an overview of all tasks and people assigned

get a sense of the state of my project and tasks

* * *

existing user

search for people and tasks

quickly find the person or task I watn

* * *

existing user

group tasks according to categories/tags

manage a larger number of tasks easily

* *

existing user

be alerted to tasks near their deadline

complete tasks on time

* *

project manager

send email notifications to people I assigned tasks to

ensure they are on track with tasks

* *

user

see milestones visualised using a calendar

have a more chronological sense of my tasks

* *

user

view team members’ calendars and share my own

coordinate meetings and track progress

* *

user

track the extent of others’ involvement in each task

ensure fair distribution of credit

* *

user

use this product as a web app

easily access my tasks/work on all platforms

* *

user

create recurring tasks

avoid repeatedly creating a new task for each recurrence

* *

user

have Autocomplete when typing tags

find existing tags faster

*

power user

create command aliases

enter commands more efficiently

*

power user

vim-mode CLI

enter commands more efficiently

*

power user

emacs-mode CLI

enter commands more efficiently

Appendix C: Use cases

C.1. Create a contact

MSS

  1. User requests to add a person, together with all the attributes.

  2. Cow adds that person to the contacts.

    Use case ends.

Extensions

  • 1a. User provides an invalid attribute.

    • 1a1. Cow shows an error message.

      Use case ends.

C.2. List contacts

  1. User requests to list persons.

  2. Cow shows a list of persons.

    Use case ends.

C.3. Update a contact

MSS

  1. User requests to list persons.

  2. Cow shows a list of persons.

  3. User requests to update a specific person in the list, together with the new attributes.

  4. Cow updates the person with the given attribute.

    Use case ends.

Extensions

  • 2a. The list is empty.

    Use case ends.

  • 3a. User provides an invalid index.

    • 3a1. Cow shows an error message.

      Use case resumes at step 2.

  • 3a. User provides an invalid attribute.

    • 3a1. Cow shows an error message.

      Use case resumes at step 2.

C.4. Select a contact

MSS

  1. User requests to list contacts.

  2. Cow shows a list of contacts.

  3. User requests to select a specific contact in the list.

  4. Cow selects the contact.

    Use case ends.

Extensions

  • 2a. The list is empty.

    Use case ends.

  • 3a. User provides an invalid index.

    • 3a1. Cow shows an error message.

      Use case resumes at step 2

C.5. Delete a contact

MSS

  1. User requests to list persons.

  2. Cow shows a list of persons.

  3. User requests to delete a specific person in the list.

  4. Cow deletes the person.

    Use case ends.

Extensions

  • 2a. The list is empty.

    Use case ends

  • 3a. User provides an invalid index.

    • 3a1. AddressBook shows an error message.

      Use case resumes at step 2.

C.6. Create a task

MSS

  1. User requests to add a task, together with all the attributes.

  2. Cow adds that task.

    Use case ends.

Extensions

  • 1a. User provides an invalid attribute.

    • 1a1. Cow shows an error message.

      Use case ends.

C.7. List tasks

  1. User requests to list tasks.

  2. Cow shows a list of tasks.

    Use case ends.

C.8. Edit a task

MSS

  1. User requests to list tasks.

  2. Cow shows a list of tasks.

  3. User requests to edit a specific task in the list, together with the new attributes.

  4. Cow edits the task with the given attribute.

    Use case ends.

Extensions

  • 2a. The list is empty.

    Use case ends.

  • 3a. User provides an invalid index.

    • 3a1. Cow shows an error message.

      Use case resumes at step 2.

  • 3a. User provides an invalid attribute.

    • 3a1. Cow shows an error message.

      Use case resumes at step 2

C.9. Select a task

MSS

  1. User requests to list tasks.

  2. Cow shows a list of tasks.

  3. User requests to select a specific task in the list.

  4. Cow selects the task.

    Use case ends.

Extensions

  • 2a. The list is empty.

    Use case ends

  • 3a. User provides an invalid index.

    • 3a1. Cow shows an error message.

      Use case resumes at step 2.

C.10. Delete a task

MSS

  1. User requests to list tasks.

  2. Cow shows a list of tasks.

  3. User requests to delete a specific task in the list.

  4. Cow deletes the task.

    Use case ends.

Extensions

  • 2a. The list is empty.

    Use case ends

  • 3a. User provides an invalid index.

    • 3a1. Cow shows an error message.

      Use case resumes at step 2

C.11. Batch delete tasks

MSS

  1. User requests to list tasks.

  2. Cow shows a list of tasks.

  3. User requests to delete a number of tasks in the list.

  4. Cow deletes the specified tasks.

    Use case ends.

Extensions

  • 2a. The list is empty.

    Use case ends.

  • 3a. User provides a list of indices containing an invalid index.

    • 3a1. Cow shows an error message. Use case resumes at step 2

C.12. Delete all tasks

MSS

  1. User requests to list tasks.

  2. Cow shows a list of tasks.

  3. User requests to delete all tasks in the list.

  4. Cow deletes all tasks in the list.

C.13. Assign people to a task

MSS

  1. User requests to list people.

  2. Cow shows a list of people.

  3. User requests to list tasks.

  4. Cow shows a list of tasks.

  5. User requests to assign a person to a task.

  6. Cow assigns the person to the task.

    Use case ends

Extensions

  • 2a. The list is empty.

    Use case ends.

  • 4a. The list is empty.

    Use case ends.

  • 5a. User provides an invalid person or task index.

    • 5a1. Cow shows an error message.

      Use case ends.

  • 5b. User requests to assign a person already assigned to the task.

    • 5b1. Cow shows a message telling the user the person is already assigned.

      Use case ends.

C.14. Unassign person from a task

MSS

  1. User searches for a contact.

  2. Cow displays the contact.

  3. User requests to view tasks assigned to the contact.

  4. Cow displays a list of tasks assigned to the contact.

  5. User requests to unassign a contact from a task.

  6. Cow unassigns the contact from the task.

    Use case ends

Extensions

  • 2a. The list is empty.

    Use case ends.

  • 4a. The list is empty.

    Use case ends.

  • 5a. User provides an invalid person or task index.

    • 5a1. Cow shows an error message.

      Use case ends.

  • 5b. User requests to unassign a person that is not assigned to the task.

    • 5b1. Cow shows a message telling the user the person is not assigned.

      Use case ends.

C.15. View calendar

MSS

  1. User requests to display calendar for specified month and year.

  2. Cow displays the specified month and year in the calendar panel populated with tasks based on task end date.

    Use case ends

C.16. List calendars

MSS

  1. User requests to list calendars.

  2. Cow displays list of all calendars I have access to, including shared calendars.

    Use case ends

C.17. Import calendar

MSS

  1. User requests to import calendar XML file and specifies calendar name.

  2. Cow imports tasks contained in XML file into the a calendar with the specified name.

    Use case ends

Extensions

  • 2a. A calendar already exists with the specified name.

    • 2a1. Cow notifies the user and merges the incoming calendar with the pre-existing calendar.

      Use case ends.

C.18. Share calendar

MSS

  1. User requests to share his calendar.

  2. Cow exports an XML file containing all current existing tasks to the specified path.

    Use case ends

Appendix D: Non-Functional Requirements

  • Disability friendly

    • colour scheme

    • compatibility with screen readers

    • on-screen keyboard

  • Infinitely scalable (serverless back end on AWS Lambda-equivalent)

  • Support alternative (better, faster) forms of storage

  • Should work on any mainstream OS as long as it has Java 9 or higher installed.

  • Advanced analytics on tasks for work efficiency insights

  • Remove all N+1 queries and O(n) lookups

Appendix E: Glossary

  • Mainstream OS

    • Windows, Linux, Unix, OS-X

  • Tasks

    • Text describing work to be done, may be attached to one or more contacts

  • Alternative storage

    • Local/Remote databases

  • Contact

    • Represents a person, with name, email, etc.

Appendix F: Product survey

  • GitHub/GitLab/Bitbucket Issues

  • Bugzilla

  • Jira

  • Launchpad

  • Asana

  • Trello

  • Pen and paper

  • Email

  • Orgmode

Appendix G: Instructions for Manual Testing

Given below are instructions to test the app manually.

G.1. Launch and Shutdown

  1. Initial launch

    1. Download the jar file and copy into an empty folder

    2. Double-click the jar file
      Expected: Shows the GUI with a set of sample contacts and tasks. The window size should be optimum if your screen’s resolution is at least 1920x1080.

  2. Saving window preferences

    1. In case window size is not optimum, resize the window to an optimum size. Move the window to a different location. Close the window.

    2. Re-launch the app by double-clicking the jar file.
      Expected: The most recent window size and location is retained.

  3. Closing the application

    1. Test case: exit Expected: the application should exit and the window should disappear.

G.2. Adding Tasks

  1. Adding a task while all tasks are listed

    1. Prerequisites: List all tasks using the tasks list command. There can be any number of tasks in the list.

    2. Test case: tasks add n/Brush the cows sd/20180101 st/0000 ed/20181231 et/2359 t/Chill Expected: A new task with the fields entered is added to the bottom of the task list.

    3. Test case: tasks add n/Slaughter the cows ed/20190101 et/1200 Expected: A new task with the entered name and end date and time is added with the current date and time as the start date and time.

    4. Test case: tasks add n/Feed the cows sd/20180101 st/2359 ed/20180101 et/0000 Expected: No task is added. An error message is shown.

    5. Test case: tasks add n/Feed the cows ed/19700101 et/0000 Expected: No task is added. An error message is shown.

    6. Test case: tasks add n/Feed the cows sd/20180101 st/0000 ed/20180231 et/2500 Expected: No task is added. An error message is shown.

    7. Other incorrect tasks add commands to try: Names containing non-alphanumeric characters, dates that don’t exist on the calendar, times outside the range 0000-2359 inclusive, wrongly formatted dates and times.

G.3. Editing Tasks

  1. Editing a task while all tasks are listed

    1. Prerequisites: List all tasks using the tasks list command. There are at least 4 tasks in the list.

    2. Test case: tasks edit 1 n/Slaughter the cow
      Expected: First task is edited such that its name is now Slaughter the cow. New details of the edited task are shown in the status message. Timestamp in the status bar is updated.

    3. Test case: tasks edit 1 sd/20180101 st/0000 ed/20180101 et/2359
      Expected: First task is edited such that its start date and time are 1 January 2018, 00.00am and its end date and time are 1 January 2018, 23.59pm. New details of the edited task are shown in the status message. Timestamp in the status bar is updated.

    4. Test case: tasks edit 1 t/
      Expected: First task is cleared of any tags that it might have had. New details of the edited task are shown in the status message. Timestamp in the status bar is updated.

    5. Test case: tasks edit 1 t/messy
      Expected: First task’s tag is now only messy. New details of the edited task are shown in the status message. Timestamp in the status bar is updated.

    6. Test case: tasks edit 1 t/messy t/mean
      Expected: First task’s tags are now mean and messy. They are shown in no particular order. New details of the edited task are shown in the status message. Timestamp in the status bar is updated.

    7. Other correct tasks edit command to try: Combining editing name with start and/or end date and time and/or tags, Editing only start date and time as long as they are before the end date and time.

    8. Test case: tasks edit 0 n/Slaughter the cow
      Expected: No task is edited. Error detail is shown in the status message. Status bar remains the same.

    9. Test case: tasks edit 1 sd/20181231 st/0000 ed/20180101 et/2359
      Expected: No task is edited. Error detail is shown in the status message. Status bar remains the same.

    10. Test case: tasks edit 1
      Expected: No task is edited. Error detail is shown in the status message. Status bar remains the same.

    11. Other incorrect tasks edit command to try: tasks edit, tasks edit x (where x is negative or larger than the list size), Editing with invalid start and/or date and/or time, Editing with non-alphanumeric characters in the task name.

G.4. Deleting Task(s)

  1. Deleting a task while all tasks are listed

    1. Prerequisites: List all tasks using the tasks list command. There are at least 4 tasks in the list.

    2. Test case: tasks delete 1
      Expected: First task is deleted from the task list. Details of the deleted task are shown in the status message. Timestamp in the status bar is updated.

    3. Test case: tasks delete 0
      Expected: No task is deleted. Error detail is shown in the status message. Status bar remains the same.

    4. Other incorrect tasks delete command to try: tasks delete, tasks delete x (where x is negative or larger than the list size)

  2. Deleting multiple tasks while all tasks are listed

    1. Prerequisites: List all tasks using the tasks list command. There are at least 4 tasks in the list.

    2. Test case: tasks delete 1 3 2
      Expected: First, second and third tasks are deleted from the task list. Details of the deleted tasks are shown in the status message. Timestamp in the status bar is updated.

    3. Test case: tasks delete 1 4 0
      Expected: No task is deleted. Error detail is shown in the status message. Status bar remains the same.

    4. Other incorrect tasks delete command to try: tasks delete 1 2 x (where x is negative or larger than the list size)

  3. Deleting all tasks shown in the task list

    1. Prerequisites: List all tasks using the tasks list command. There are at least 1 task.

    2. Test case: tasks delete all
      Expected: All tasks shown in the task list are deleted. Details of the deleted tasks are shown in the status message. Timestamp in the status bar is updated.

G.5. Filtering tasks

  1. Searching for tasks

    1. Prerequisites: There are multiple tasks in the list for visible results.

    2. Test case: tasks find n/work
      Expected: Any tasks with work in the name are listed in the tasks list panel. Number of tasks listed is shown in the status message.

    3. Test case: tasks find t/farm
      Expected: Any tasks with the farm tag are listed in the tasks list panel. Number of tasks listed is shown in the status message.

    4. Test case: tasks find sd/20180105
      Expected: Any tasks that starts at 20180105 are listed in the tasks list panel. Number of tasks listed is shown in the status message.

    5. Test case: tasks find n/hello sd/20181103
      Expected: Any tasks with hello in the name and start date 20181103 are listed in the tasks list panel. Number of tasks listed is shown in the status message.

    6. Test case: tasks find t/
      Expected: Task list is not changed. Error details is shown in the status message.

    7. Other incorrect commands to try: tasks find n/, tasks find sd/invaliddate, tasks find ed/
      Expected: Similar to previous.

G.6. Calendar Show

ℹ️
Tasks with long names will be truncated in the calendar.
If there are more than 5 tasks ending on that day, the cell will be scrollable, but a scroll bar is not displayed due to space constraints.
  1. Calendar show command displays specified month in calendar.

    1. Test case: calendar show y/2018 m/1
      Expected: Calendar header changes to "January 2018". Days of the week should be correctly displayed.

  2. Calendar displays tasks ending in specified month.

    1. Pre-requisites:

      1. List all tasks using the tasks list command.

      2. Display calendar for January 2018 using the calendar show y/2018 m/1 command.

    2. Test case: tasks add n/test calendar show sd/20170101 ed/20180115 et/1200
      Expected: Cell corresponding to 15 Jan 2018 contains the entry displaying "test calendar show".

  3. Calendar displays multiple tasks due on the same day

    1. Pre-requisites: List all tasks using the tasks list command.

    2. Enter the tasks add n/test calendar multiple sd/20170101 ed/20181212 et/1200 command 3 times.

    3. Enter the calendar show y/2018 m/12 command.
      Expected: Cell corresponding to 12 December 2018 has multiple entries displaying "test calendar multiple".

  4. Calendar displays adjacent months correctly.

    1. Pre-requisites:

      1. List all tasks using the tasks list command.

      2. Display calendar for December 2018 using the calendar show y/2018 m/12 command.

    2. Test case: tasks add n/test calendar previous month sd/20170101 ed/20181127 et/1200.
      Expected: Cell corresponding to 27 November 2018 has one new entry displaying "test calendar previous month".

    3. Test case: tasks add n/test calendar following month sd/20170101 ed/20190102 et/1200
      Expected: Cell corresponding to 2 Jan 2019 has one new entry displaying "test calendar following month".

  5. Default displayed calendar on app startup.

    1. Create task ending in the current month.

    2. Shut down the app

    3. Launch the app
      Expected: Calendar displays the current month. Calendar should be populated with tasks ending in the current month.

  6. User input is validated.

    1. Test cases:

      1. calendar show y/0 m/12

      2. calendar show y/10000 m/12

      3. calendar show y/2018 m/0

      4. calendar show y/2018 m/13

    Expected: Calendar is unchanged. Error details shown in the status message.

G.7. Assigning a Task to a Contact

  1. Assigning a task to a contact and vice versa while some or all tasks and contacts are listed.

    1. Prerequisites: List tasks using the tasks list or tasks find commands, and list contacts using the contacts list or contacts find commands. There must be at least 1 task and 2 contacts on screen.

    2. Test case: tasks assign c/1 k/1
      Expected: First task is assigned to the first contact. Details of the assignment are shown in the status message. Timestamp in the status bar is updated.

    3. Test case: tasks assign c/1 k/1
      Expected: No assignment is made. Error detail is shown in the status message. Status bar remains the same.

    4. Test case: contacts assign c/1 k/1
      Expected: No assignment is made. Error detail is shown in the status message. Status bar remains the same.

    5. Test case: contacts assign c/2 k/1
      Expected: Second contact is assigned to the first task. Details of the assignment are shown in the status message. Timestamp in the status bar is updated.

    6. Test case: contacts assign c/2 k/1
      Expected: No assignment is made. Error detail is shown in the status message. Status bar remains the same.

    7. Test case: tasks assign c/2 k/1
      Expected: No assignment is made. Error detail is shown in the status message. Status bar remains the same.

    8. Other incorrect assign commands to try: tasks assign or contacts assign, tasks assign c/x or contacts assign c/x (where x is any integer), tasks assign k/x or contacts assign k/x (where x in any integer), tasks assign c/x k/y or contacts assign c/x k/y (where x is negative or larger than the contacts list size and/or y is negative or larger than the task list size).

G.8. Unassigning a Task from a Contact

  1. Unassigning a task from a contact and vice versa while some or all tasks and contacts are listed.

    1. Prerequisites: List tasks using the tasks list or tasks find commands, and list contacts using the contacts list or contacts find commands. There must be at least 1 task and 2 contacts on screen. Task 1 must be assigned to contacts 1 and 2, as detailed in the previous test case.

    2. Test case: tasks unassign c/1 k/1
      Expected: First task is unassigned from the first contact. Details of the unassignment are shown in the status message. Timestamp in the status bar is updated.

    3. Test case: tasks unassign c/1 k/1
      Expected: No unassignment is made. Error detail is shown in the status message. Status bar remains the same.

    4. Test case: contacts unassign c/1 k/1
      Expected: No unassignment is made. Error detail is shown in the status message. Status bar remains the same.

    5. Test case: contacts unassign c/2 k/1
      Expected: Second contact is unassigned from the first task. Details of the unassignment are shown in the status message. Timestamp in the status bar is updated.

    6. Test case: contacts unassign c/2 k/1
      Expected: No unassignment is made. Error detail is shown in the status message. Status bar remains the same.

    7. Test case: tasks unassign c/2 k/1
      Expected: No unassignment is made. Error detail is shown in the status message. Status bar remains the same.

    8. Other incorrect unassign commands to try: tasks unassign or contacts unassign, tasks unassign c/x or contacts unassign c/x (where x is any integer), tasks unassign k/x or contacts unassign k/x (where x in any integer), tasks unassign c/x k/y or contacts unassign c/x k/y (where x is negative or larger than the contacts list size and/or y is negative or larger than the task list size).