Developer Guide of DueQuest
Table of contents
- Introduction
- Welcome to DueQuest
- Setting Up
- Prerequisites
- Setting the project
- Design
- Architecture
- Task Component
- Command
- Managers
- Storage
- Implementation
- Adding
- Display
- Storage
- Edit
- Delete
- Documentation
- Basic Thing to know
- Style guidance
- Diagrams
- Testing
- Running Tests
- Types of Tests
- Appendices
- Appendix A: Product Scope
- Appendix B: User Stories
- Appendix C: Non Functional Requirements
- Appendix D: Glossary
- Appendix E: Instructions for Manual Testing
1. Introduction
Welcome to DueQuest
Hello! We appreciate your interest in contributing to DueQuest. DueQuest is an application that uses a Command Line Interface (CLI) specifically for NUS Students to manage their schedule during school. This guide is written to give a clearer understanding for developers who are interested in improving the design and implementation of DueQuest.
2.Setting Up
Prerequisites
- JDK 11
- IntelliJ IDEA
Setting the project
- Fork the repo and clone it into your computer
- Configure the JDK in IntelliJ to ensure it is configured to use JDK11.
- Click
Import Project
(orOpen or Import
in newer version of Intellij). - IntelliJ IDEA by default has the Gradle plugin installed. If you have disabled it, go
to
File → Settings → Plugins
to re-enable them. - Locate the build.gradle file (not the root folder as you would do in a normal
importing) and select it. Click
OK
. If asked, choose toOpen as Project
(notOpen as File
). - Click
OK
to accept the default settings but do ensure that the selected version ofGradle JVM
matches the JDK being used for the project. - Wait for the importing process to finish (could take a few minutes).
3. Design
Architecture
The diagram below shows a flow chart which gives an overall general picture of how the application works whenever the application receives an input from the user and a shows how each component interacts with one another for different scenarios. The logic behind the application is mostly handled by the Parser
which converts inputs into various executable Command
.
Module Component
ModuleManager
is the class that maintains the list of Module
for the app and provides appropriate API to manipulate these modules.
Class | Function |
---|---|
Module |
Module class has attributes such as moduleCode , title , auNumber and teachingSatffs , and it also keeps the records of Assessment (e.g. assignments, exams, etc.) |
Assessment |
Assessment class stores the scores obtained by the user for the assessments he did for the Module |
To manipulate the module, the developer needs to access it from ModuleManager
, generally through APIs such as getModule(moduleCode: String)
.
Task Component
Each Task
can be a Lesson
, Event
or Deadline
. Below is a UML diagram showing
some of the properties and methods that these classes have. A Task
will be created
whenever a User wants to add a Task into the ScheduleManager
or ModuleManager
.
Class | Function |
---|---|
Task |
Parent class of Lesson , Deadline and Event |
Lesson |
Represents an Lesson object. A Lesson object represents a lesson for a module that occurs during the semester, maintaining information such as the description of the lesson, startTimeOfLesson , endTimeOfLesson , and day of the week which it occurs on (which is noted by the frequency ). |
Deadline |
Represents an Event object. An Event object represents a one-off event for a module that maintains information such as date of the event, startTimeOfEvent , endTimeOfEvent . |
Event |
Represents a Deadline object. A Deadline object represents a deadline for a module that maintains information such as description of the deadline and date of the deadline. |
Command
The logic of what should be executed whenever the application receives an input will be
handled by parsing these inputs into Commands using a Parser . Below is a UML Diagram
showing how the Parser
classes and the Command
classes interact. Unless the Command
is
an ExitCommand
or HelpCommand
, the Command
will be executed to perform an action to
either the ScheduleManager
or ModuleManager
or both.
Class | Function |
---|---|
Command |
An Abstract class which is the parent class of all of the commands below. The main method in this class is the execute() method, which handles the different executions required depending on the input by the user. |
AddCommand |
A child class of Command which helps to execute the feature of adding a Task into the ScheduleManager and ModuleManager . |
AddModuleCommand |
A child class of Command which helps to add a Module into the ModuleManager . |
DeleteCommand |
A child class of Command to execute methods to delete a Task and Module |
DisplayCommand |
A child class of Command which helps to display the list of tasks in a any day stated by the user, or the list of tasks from a Module stated by the user. |
EditCommand |
A child class of Command to execute edit methods |
EditModuleCommand |
A child class of EditCommand to execute edit methods that has a module code in the input. |
EditTaskCommand |
A child class of EditCommand to execute edit methods without a module code in the input. |
HelpCommand |
A child class of Command which helps to provides the list of inputs for the user to know what to type in to use any of the features he wants. |
ExitCommand |
A child class of Command which helps to exit the app. |
AddAssessmentCommand |
A child class of Command which adds assessment to the module. |
ScoreAssessmentCommand |
A child class of Command which adds actual score to the assessment. |
DeleteAssessmentCommand |
A child class of Command which deletes the assessment from the module. |
Managers
The application consists of two managers, the ScheduleManager
and ModuleManager
. The
ScheduleManager
will handle the storing of Task
in each day. The ModuleManager
will
handle storing the task of each Module
.
Below is a UML Diagram showing some of the key methods and properties of the ScheduleManager
and ModuleManager
classes.
Class | Function |
---|---|
ScheduleManager |
The ScheduleManager class helps to store the Task s in each day. |
ModuleManager |
ModuleManager class helps to store the Task s of each module. |
Some Design Considerations on how to store the Task
in the ScheduleManager
:
- Use of a
TreeMap
to store the date as keys andArrayList
as values.- Pros: Use of a
TreeMap
allows iteration of dates as the key to be iterated in order, which might be useful in further development of implementation of the use of theScheduleManager
. Searching for a date can also be done in O(logn) similarly to aHashMap
. - Cons: Storing the dates that have past and also storing of many dates might be heavy in terms of space.
- Pros: Use of a
- Use of a
HashMap
to store the date as keys andArrayList
as values- Pros: Allows tracking of tasks with respect to the dates as keys.
- Cons: Does Not allow iteration in order as when desired as compared to a
TreeMap
.
- Creation of a new class which contains a schedule for each day, and using a
TreeSet
. to contain this new class.- Pros: Making use of more oop design.
- Cons: Might be tricky to implement and may need more resources.
Storage
The application will save all of the application’s data to a local directory (specified when launching the jar
file) by using a Storage
class, which is designed as singleton and can only be created and assessed through public class methods of Storage.
When DueQuest
is launched, the Storage
instance will be created and read all the files in the specified storage directory. After that, it will load data into ScheduleManager
and ModuleManager
.
When using the app, the commands (not all of them, e.g. exit, help, display commands won’t call Storage
) will call Storage
to export updated module to local files every time they are executed.
Below is the UML of Storage
:
Class | Function |
---|---|
Storage |
It exports the data in the application and converts it into the form of a txt file. This allows users to retain their saved data after exiting the app. More elaboration of how this will be done will be shown later, where a sequence diagram will show how this process works. |
4. Implementation
This section describes some noteworthy details on how certain features are implemented.
Add Feature
The add implementation allows the user to add a Lesson
, Event
or Deadline
. This is facilitated
by implementing the ScheduleManager and ModuleManager, which stores all of the Task
in
them. The ScheduleManager
helps to save these tasks into the dates according to the date of
the Task
as stated by the User. The ModuleManager
will also add the Task
into the respective module
that it belongs to. Below is a sequence diagram which shows how adding of a
Lesson
works. Adding of a Event or a Deadline is also in a similar fashion.
- The user inputs
lesson online lecutre CS2113 /on 5 16:00 18:00
, which will be by read by theUi
by it’sreadCommand()
method, and returned as a String variable calledfullCommand
. - A
Parser
is then used to obtain the logic behind the user’s input. TheParser
will first use it’sparse(fullCommand)
method, which will then call theparseLesson(fullCommand)
method after finding out that the user wants to add a lesson since that was the first word in the user input for this case. - The
parseLesson(fullCommand)
method will return aLesson lesson
object. It will also call aAddCommand
, which will contain theLesson lesson
object, and theAddCommand
will be returned to theDueQuest
main class. - Next, the
AddCommand
will be executed to handle the logic of adding a lesson with the details as stated by the user’s input. - Finally, the
execute(ScheduleManager scheduleManager, ModuleManager moduleManager)
will first call theScheduleManager
, which calls its ownaddLesson(lesson, moduleManager, ui)
method to add the lesson to itself. It also calls theModuleManager
object, and theModuleManager
will call its ownaddTaskToModule(lesson, moduleCodeOfLesson)
to add the lesson to theModule
in it which has the module code stated by the user.
Display Feature
For display method, there are 5 possible scenarios that could include parameters such
as Module
code, date & range of date.
As seen from the diagram, the 5 Scenarios are:
- Display today Schedule
- Display all information in a specific module
- Display all task in a specific module on a specific date
- Display all task within a range of dates
- Display all task on a specific date
Example: flow for Displaying today schedule:
- The user will run the app and type in “display”, which will then be received by the
Ui
and it returns the input as a String fullCommand - The String fullCommand will then be parsed by a
Parser
to return anDisplayCommand
object. - The DisplayCommand object will then be executed to display today’s Schedule using the
ScheduleManager.displayToday()
method
Storage Feature
The storage is implemented in singleton such that the Storage
class holds only 1 private instance, the constructor of which (e.g. Storage(directoryPath)
) is private. Such instance can only be created with the class method, Storage.setUpStorage(directoryPath)
.
- Set up the
Storage
from local disk.storage
instance will be created.
- Add/Edit Module and Its Components
When modules’ information or their components are changed (e.g. add, delete the module or add, delete the assessments, etc.), the changed module’s code will be passed to storage.
Storage
will export the new information of the changedModule
to the corresponding local files.
- Edit/Delete Action
- When multiple modules are affected. Storage will export the new content of
ModuleManager
by iterating all modules inModuleManager
, since the module is not specified. Below is the sequence diagram with the example of task deletion:
- When the task only on specific date is modified. The command of edit/deleting is passed to
Storage
, andStorage
will write this command string toAdditionalFile
, so that whenever importing files, thisDeleteCommand
orEditCommand
will be executed again fromAdditionalFile
. Below is an example of deleting the task:
- When the frequent task of a module is deleted for all dates,
Storage
will export the updated module to the corresponding local file. (the sequence diagram is the same as 2. Add/Edit Module and Its Components)
Edit Feature
The EditCommand
base class forms the basis for the two extensions listed below.
- Edit Module Command: When the
EditModuleCommand
is executed, it checks for the description of the particular property to edit withScheduleManager
andModuleManager
. The constructor function is overloaded such that the conditions will check for which property to edit. In the case that there are no module details to modify, the function execution will go on to check for module tasks to modify.
- Edit Task Command: When the
EditTaskCommand
is executed, it checks for the description of the particular property to edit withScheduleManager
andModuleManager
. The constructor function is overloaded such that the conditions will check for which property to edit.
Delete Feature
The DeleteCommand
is the class which oversees the deletion of modules and tasks.
- The
DeleteCommand
class is overloaded such that the conditions of the deletion are checked. TheScheduleManager
andModuleManager
both manage their deletions separately, overloading the deletions where necessary.
5. Documentation
This Section describes how to write documentation for the project. The projects is written in GitHub-Flavoured Markdown
Basic Thing to know
- The docs/ folder is used to store documentation file
Style guidance
- Google developer Documentation style guide
- [se-edu/guides] Markdown coding standards
Diagrams
- Draw.io (free)
Testing
6. Running Tests
Running Tests
There are two ways to run tests
- Using IntelliJ JUnit Test Runner
- To run all the test, right click on the src/test/java and choose Run ‘Tests in tp.test’
- To run a subset of test, you can right click on a test package, test class, or a test and choose run “ScheduleManagerTest”
- Using Gradle
- Open a console and run the command gradlew clean test
- For Mac or linux users, use ./gradlew clean test
Types of Tests
For this project, we used: - Unit Test. For eg, seedu.ModuleManagerTest. - Integration Testing. For eg, seedu.duequest.DueQuestTest.
7. Appendices
Appendix A: Product Scope
Target user profile
The target user for our app is for:
- NUS Students who hope to have a platform for them to manage their schedule and work in the school semester.
- Users who can type fast.
- Users who are reasonably comfortable using CLI applications.
Value proposition
To help NUS Students by keeping them on track with their schedule and work on a daily basis using a CLI driven app. Thus, reducing the chances of them forgetting about any work related to school.
Appendix B: User Stories
This is an example of how we originally tackle the user stories.
- The green or orange highlight is to group similar features together
- The Strikethrough is when a feature is redundant or unneccessary at the stage of planning
Appendix C: Non Functional Requirements
- Should work on any mainstream OS as long as it has Java
11
or above installed. - Should be quick enough to take in input from the user and show output for the user.
- 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.
Appendix D: Glossary
- Mainstream OS: Windows, Linux, Unix, OS-X
Appendix E: Instructions for Manual Testing
Given below are instructions to test the app manually.
Initial Launch
- Download the latest executable jar file from our latest release.
- Copy the jar file into an empty folder.
- Run the program using the command line by inputting
java -jar DueQuestv2.1jar
. - You should see the following below
Adding a module
Positive Test
- Enter
module c/CS2113 a/4 s/Dr.Akshay s/ChengChen
into the console and you should see the following below:
Negative Test 1: Duplicate module code
- Enter
module c/CS2113 a/4 s/Dr.Akshay s/ChengChen
again into the console and you should see the following below:
Negative Test 2: Invalid module code
- Enter
module c/cs2113 a/4 s/Dr.Akshay s/ChengChen
into the console and you should see the following below:
Negative Test 3: au not specified
- Enter
module c/ST2113
into the console and you should see the following below:
Adding Tasks.
There are three types of tasks to add: Lesson
, Event
and Deadline
Adding a Lesson
Positive Test
- Enter
lesson online lecture CS2113 /on 5 16:00 18:00
into the console and you should see the following below:
- Enter
display CS2113
into the console and you should see if the lesson has been indeed added to the module. You should see the following below:
Negative Test 1: A module code that does not exist in the ModuleManager
- Enter
lesson online lecture MA2113 /on 5 16:00 18:00
into the console and you should see the following below:
Negative Test 2: Invalid Start Time
- Enter
lesson online lecture CS2113 /on 5 16:aa 18:00
into the console and you should see the following below:
Negative Test 3: Invalid frequency
- Enter
lesson online lecture CS2113 /on 8 16:00 18:00
into the console and you should see the following below:
Adding an Event
Positive Test
- Enter
event CS2113 final exam /at 2021-05-03 14:00 16:00 LT14
into the console and you should see the following below:
- Enter
display /date 2021/05/03
into the console and to see that the event has been indeed added to the date. You should see the following below:
- Enter
display CS2113
into the console and to see that the event has been indeed added to the module. You should see the following below: Note: The lesson added previously is still inside CS2113
Negative Test 1: A module code that does not exist in the ModuleManager
- Enter
event MA3333 final exam /at 2021-05-03 14:00 16:00 LT14
into the console and you should see the following below:
Negative Test 2: A date that is out of range (meaning not between 1 January 2021 and 31 May 2021)
- Enter
event CS2113 final exam /at 2021-06-01 14:00 16:00 LT14
into the console and you should see the following below:
Negative Test 3: A start time that is too early
- Enter
event CS2113 final exam /at 2021-05-01 07:00 10:00 LT14
into the console and you should see the following below:
Adding an Deadline
Positive Test
- Enter
deadline CS2113 TP version 1 /by 2021-04-04
into the console and you should see the following below:
- Enter
display /date 2021/04/04
into the console and to see that the deadline has been indeed added to the date. You should see the following below:
- Enter
display CS2113
into the console to see that the deadline has been indeed added to the module. You should see the following below: Note: the lesson and event added before this is still inside CS2113
Negative Test 1: deadline with empty description
- Enter
deadline CS2113 /by 2021-04-04
into the console and you should see the following below:
Negative Test 2: deadline with invalid date format
- Enter
deadline CS2113 TP version 1 /by 2021-4-4
into the console and you should see the following below:
Adding an Assessment
Positive Test
- Enter
assessment CS2113 TP 100
into the console and you should see the following below:
- Enter
display CS2113
into the console to see if the assessment has been indeed added. You should see the following below: Note: the lesson, event and deadline added before is still inside CS2113
Negative Test 1: Missing assessment title name
- Enter
assessment CS2113 100
into the console and you should see the following below:
Add score to an assessment
Positive Test
- Enter
score CS2113 TP 100
into the console and you should see the following below:
- Enter
display CS2113
into the console to see if the score of the assessment has been indeed added. You should see the following below:
Negative Test 1: Adding score to an assessment with a title that does not exist in the module.
- Enter
score CS2113 aa 100
into the console and you should see the following below:
Negative Test 2: Adding score to an assessment to a module that does not exist
- Enter
score CT2113 TP 100
into the console and you should see the following below:
Delete an assessment
Positive Test
- Enter
delete_assessment CS2113 TP
into the console and you should see the following below:
- Enter
display CS2113
into the console to see if the assessment has been indeed deleted. You should see the following below:
Negative Test 1: Deleting of an assessment that does not exist
- Enter
delete_assessment CS2113 minitest
into the console and you should see the following below:
Display
Positive Test
- Enter
display CS2113
into the console and you should see the following below:
Negative Test 1: Module code that does not exist
- Enter
display CS2113T
into the console and you should see the following below:
Display all the task in a module on a date
Positive Test
- Enter
display CS2113 /date 2021/04/04
into the console and you should see the following below:
Negative Test 1: Invalid date
- Enter
display CS2113 /date 2021/04/0a
into the console and you should see the following below:
Display all the task on a date
Positive Test
- Enter
display /date 2021/05/03
into the console and you should see the following below:
Negative Test 1: Invalid Date: Date not between 1 January 2021 and 31 May 2021
- Enter
display /date 2020/12/31
into the console and you should see the following below:
Display all the task on a range of date
Positive Test
- Enter
display /date 2021/05/02-2021/05/05
into the console and you should see the following below:
Negative Test 1: Invalid date format
- Enter
display /date 2021/00/02-2021/06/05
into the console and you should see the following below:
Editing a task
Important! Please do the following before carrying on with the rest of the tests for this section.
- Enter
delete c/CS2113
into the console and you should see the following below:
- Enter
module c/CS2113 a/4
to add the module and you should see the following below:
Edit the date of a task with description
Positive Test
- Enter
deadline CS2113 tp /by 2021-04-20
into the console and you should see the following below:
- Enter
edit tp /date 2021-04-20 /date /2021-04-21
into the console and you should see the following below:
- Enter
display CS2113
into the console to check if the date of the task tp has been indeed changed in the module, and you should see the following below:
- Enter
display /date 2021/04/21
into the console to check if the date of the task tp has been indeed changed in the date, and you should see the following below:
Negative Test 1: Description that does not match any task
- Enter
edit team_pro /date 2021-04-20 /date /2021-04-21
into the console and you should see the following below:
Edit the date of a task with description and module code
Positive Test
Note: We carry on from the previous example, so there exist a task on 2021/04/21 tp from before
- Enter
edit c/CS2113 tp /date 2021-04-21 /date /2021-04-20
into the console and you should see the following below:
- Enter
display CS2113
into the console to check if the date of the task tp has been indeed changed in the module, and you should see the following below:
- Enter
display /date 2021/04/20
into the console to check if the date of the task tp has been indeed changed in the date, and you should see the following below:
- Enter
display /date 2021/04/21
into the console to check if the date of the task tp has been indeed changed in the date, and you should see the following below:
Negative Test 1: Invalid module code
- Enter
edit c/CS2114 tp /date 2021-04-20 /date /2021-04-21
into the console and you should see the following below:
Deleting tasks
Important! Please do the following before carrying on with the rest of the tests for this section.
- Enter
delete c/CS2113
into the console and you should see the following below:
- Enter
module c/CS2113 a/4
to add the module and you should see the following below:
Deleting task via description
Positive Test
- Enter
deadline CS2113 tp /by 2021-04-20
into the console and you should see the following below:
- Enter
delete tp
into the console and you should see the following below:
- Enter
display CS2113
into the console to check if the date of the task tp has been indeed deleted in the module, and you should see the following below:
Note: Notice that the deadline has been deleted
- Enter
display /date 2021/04/20
into the console to check if the date of the task tp has been indeed deleted in the date, and you should see the following below:
Negative test 1: deleting task with description that does not exist in the app
- Add back the deadline by entering
deadline CS2113 tp /by 2021-04-20
into the console and you should see the following below:
- Enter
delete tpp
into the console and you should see the following below:
Deleting task via description and date
Note: Remember that there is already a deadline that was not deleted in the earlier part
Positive test
- Enter
delete tp /date 2021-04-20
into the console and you should see the following below:
- Enter
display CS2113
into the console to check if the date of the task tp has been indeed deleted in the module, and you should see the following below:
- Enter
display /date 2021/04/20
into the console to check if the date of the task tp has been indeed deleted in the date, and you should see the following below: Note: Notice that the deadline has been deleted
Negative Test 1:Invalid date
- Add back the deadline by entering
deadline CS2113 tp /by 2021-04-20
into the console and you should see the following below:
- Enter
delete tp /date 2021-04-aa
into the console and you should see the following below:
Delete all of a module’s task on a certain date
Note: Remember that there is already a deadline that was not deleted in the earlier part
- Add another deadline by entering
deadline CS2113 tp jar file /by 2021-04-20
into the console and you should see the following below:
- Enter
delete c/CS2113 /date 2021-04-20
into the console and you should see the following below:
- Enter
display CS2113
into the console to check if the date of the task tp has been indeed deleted in the module, and you should see the following below: Note: Notice all the tasks of CS2113 has been deleted)
- Enter
display /date 2021/04/20
into the console to check if the date of the task tp has been indeed deleted in the date, and you should see the following below: Note: Notice all the tasks of on 2021/04/20 has been deleted)
Negative Test 1: Invalid date
- Add back the deadline by entering
deadline CS2113 tp /by 2021-04-20
into the console and you should see the following below:
- Enter
delete c/CS2113 /date 2021-04-2a
into the console and you should see the following below:
Delete all of a module’s task’s with fitting description, on a certain date
Note: Remember that there is already a deadline that was not deleted in the earlier part
Positive Test
- Add another deadline by entering
deadline CS2113 tp dg /by 2021-04-25
into the console and you should see the following below:
- Enter
delete c/CS2113 tp /date 2021-04-20
into the console and you should see the following below:
- Enter
display CS2113
into the console to check if the date of the task tp has been indeed deleted in the module, and you should see the following below:
- Enter
display /date 2021/04/20
into the console to check if the date of the task tp has been indeed deleted in the date, and you should see the following below:
Negative Test: Invalid date
Note: Remember that you still have the deadline tp dg by 2021-04-25 in the app
- Enter
delete c/CS2113 tp /date 2021-04-2a
into the console and you should see the following below:
Deleting entire module
Positive Test
- Enter
delete c/CS2113
into the console and you should see the following below:
- Enter
display CS2113
into the console to check if the date of the task tp has been indeed deleted in the module, and you should see the following below:
Negative Test: Module code that does not exist in the app
- Add the module back by entering
module c/CS2113 a/4
into the console and you should see the following below:
- Enter
delete c/CS2113T
into the console and you should see the following below:
Exiting the app
Positive Test
- Enter
bye
into the console and you should see the following below:
Negative Test 1: Invalid input
- Enter
byee
into the console and you should see the following below: