-
Notifications
You must be signed in to change notification settings - Fork 438
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Joven Heng] IP #88
base: master
Are you sure you want to change the base?
[Joven Heng] IP #88
Conversation
…d test or inserted test cases, will do after level 7
Fixed a typo from Level-4
Added in the expected and input test cases.
Text file used for to remember the list of jobs done by the chatbot Let's * Use a storage class to handle the read and writing of txt files. * Use the txt file to store the current list such that it can be reused again after closing Duke
Delete task.txt
Tasks has different dates and times when they are created and due. Create DateTimes to show when a task is created and when deadlines and events are due.
# Conflicts: # src/main/java/Deadline.java # src/main/java/Duke.java # src/main/java/EventTask.java
Ui: deals with interactions with the user Storage: deals with loading tasks from the file and saving tasks in the file Parser: deals with making sense of the user command TaskList: contains the task list e.g., it has operations to add/delete tasks in the list
Add Unittests for adding deadlines.
Users are unable to find tasks based on keywords. Implement find feature to allow users to search for tasks based on certain keywords.
# Conflicts: # src/main/java/duke/Duke.java # src/main/java/duke/parser/Parser.java # src/main/java/duke/storage/Storage.java # src/main/java/duke/task/Task.java # src/main/java/duke/task/deadline/Deadline.java # src/main/java/duke/task/eventtask/EventTask.java # src/main/java/duke/task/todo/ToDo.java # src/main/java/duke/tasklist/TaskList.java # src/main/java/duke/ui/UI.java
# Conflicts: # src/main/java/duke/ui/UI.java
Due to gradle not intepreting UTF-8 characters, change all special characters to normal ones
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, I found your code easy to read. I noted a few minor coding standard violations too and give some suggestions on a perhaps more intuitive variable name. Other than that, it looks good to me! 👍
|
||
public class DukeIncorrectTimeFormatException extends DukeException { | ||
|
||
public DukeIncorrectTimeFormatException(String message){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps leave a space after the argument closing parenthesis for better readability? I noticed the same issue in several other places too...
public DukeIncorrectTimeFormatException(String message){ | |
public DukeIncorrectTimeFormatException(String message) { |
src/main/java/duke/Duke.java
Outdated
* | ||
* @param sc Scanner object used to read users inputs | ||
*/ | ||
public static void handler(Scanner sc) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps handleUserInputs
will make a better variable name here?
} else if (response.indexOf("deadline ") == 0) { | ||
if (response.length() <= 9) { | ||
throw new EmptyDescriptionException("deadline"); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps you can add a space after each if
block to help increase readability.
indexer = Integer.parseInt(response.replaceAll("\\D+", "")) - 1; | ||
ui.replyDone(indexer); | ||
} else if (response.indexOf("todo ") == 0) { | ||
if (response.length() <= 5) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can I clarify that 5 here comes from length("todo ")
? If so, perhaps it is better to use length("todo ")
or a constant here instead of magic numbers?
I noticed similar issues in several other places too...
* @param shelf the TaskList that we are updating | ||
* @throws IOException if the file cannot be found | ||
*/ | ||
public void updateFile(TaskList shelf) throws IOException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps taskList
will give a more clearer context instead of shelf
?
* @throws DukeTaskNonExistException if the index provided is out of range of the arraylist | ||
*/ | ||
public void delete(int index) throws DukeTaskNonExistException { | ||
if (index < 0 | index >= shelf.size()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps you mean ||
here? I noticed the same issue in several other places too..
*/ | ||
public void listen(String response) { | ||
try { | ||
int indexer; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps a more intuitive variable name here? If I understand correctly, it is used to determine the index of task in your tasklist, so perhaps taskIndex
?
# Conflicts: # src/main/java/duke/Duke.java
# Conflicts: # src/main/java/duke/Duke.java # src/main/java/duke/parser/Parser.java # src/main/java/duke/tasklist/TaskList.java
Thanks so much :) Ill make the changes in the following days :D |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just a few nits to pick.
} | ||
|
||
/** | ||
* If a tasklist.txt file exists, this method would load it into the TaskList. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps it can be started with an action word e.g. returns?
What do you think about "Loads tasks in tasklist.txt file into the TaskList if the file exists"?
I have noticed the same issue in several places too.
/** | ||
* If a tasklist.txt file exists, this method would load it into the TaskList. | ||
* | ||
* @return A TaskList that is loaded with the tasks recorded on the txt file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps it could be ended with a full stop to be consistent with the coding standards?
I have noticed the same issue in several places too.
src/main/java/duke/ui/UI.java
Outdated
/** | ||
* Method that prints the goodbye statement | ||
*/ | ||
public String replyBye() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps the naming of the method could be improved?
The method name suggests to me that a "bye" response is printed and that it is a void return method instead of a String return method.
I have noticed the same issue in several places too.
try { | ||
ui.addDeadline("finish homework!", "2020-10-02 11:44"); | ||
String currentTime = LocalDateTime.now().format(formatter); | ||
assertEquals("Got it. I've added this task: \r\n [D][-] finish homework! [created on " + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps the + sign can be moved to the current second line of String to be consistent with the coding standards?
Implement assert feature
# Conflicts: # src/main/java/duke/storage/Storage.java # src/main/java/duke/task/Task.java # src/main/java/duke/tasklist/TaskList.java # src/main/java/duke/ui/UI.java
# Conflicts: # task.txt
No description provided.