-
Notifications
You must be signed in to change notification settings - Fork 454
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
[Tang Zhiying] iP #472
base: master
Are you sure you want to change the base?
[Tang Zhiying] iP #472
Conversation
* branch-Level-8: Add ability to understand dates and time
Extracted following classes: Ui: deals with interactions with the user Parser: deals with making sense of user command TaskList: contains the task list
Added package duke.util and duke.task
* branch-A-CodingStandard: Slight tweak to align with coding standard # Conflicts: # src/main/java/TiTi/util/Parser.java # src/main/java/TiTi/util/TaskList.java # src/main/java/TiTi/util/Ui.java
* branch-Level-9: Add function to search task using keyword # Conflicts: # src/main/java/TiTi/util/Response.java # src/main/java/TiTi/util/TaskList.java
checkDate(by); | ||
} | ||
|
||
private void checkDate(String by) { |
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 this function could be named with a verb, such as dateChecker
.
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.
thanks for the review! but dateChecker
is actually a noun! And by convention class and variable should be names with nouns, and methods should be named with verb! Just saying in case you might have made the same assumptions for your own code ;-;
src/main/java/TiTi/util/Parser.java
Outdated
if ((cue.equals("todo") || cue.equals("deadline") | ||
|| cue.equals("event") || cue.equals("find")) | ||
&& input.split(" ", 2).length == 1) { |
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.
This expression seems a little bit complicated. Perhaps you could set aside a boolean isDescriptionMissing
to handle this checking.
src/main/java/TiTi/util/Ui.java
Outdated
private static final String STARTER_NORMAL = " (=^ ・ェ・^=) < "; | ||
private static final String STARTER_BUFFER = " "; | ||
private static final String STARTER_SLEEPY = " (=^ ‐ェ‐^=) < "; | ||
private static final String STARTER_CONFUSED = " (=^ ・x・^=)? < "; | ||
private static final String STARTER_HAPPY = " (=^ ・ω・^=)❀ < "; |
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.
so cute!! 😸
src/main/java/TiTi/task/ToDo.java
Outdated
public String toString() { | ||
return "[T]" + super.toString(); | ||
} | ||
} |
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.
Do remember to add a new line here at the end of each file.
src/main/java/TiTi/util/Parser.java
Outdated
if (taskNumber > numberOfTasks) { | ||
return new Response(Response.Cue.TASKERROR); | ||
} else { | ||
Task task = taskList.get(taskNumber - 1); | ||
task.complete(); | ||
return new Response(Response.Cue.DONE, task); | ||
} |
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.
if (taskNumber > numberOfTasks) { | |
return new Response(Response.Cue.TASKERROR); | |
} else { | |
Task task = taskList.get(taskNumber - 1); | |
task.complete(); | |
return new Response(Response.Cue.DONE, task); | |
} | |
if (taskNumber > numberOfTasks) { | |
return new Response(Response.Cue.TASKERROR); | |
} | |
Task task = taskList.get(taskNumber - 1); | |
task.complete(); | |
return new Response(Response.Cue.DONE, task); | |
Since a new Response
is returned in the if-block, the else-block is not required and can be removed so the main path is un-indented.
I noticed the same issue in several other places too.
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.
There are quite a few coding standards violations, but kudos to all the effort you put into your iP! It is indeed a CUTEE chatbot!! Also, do correct me if I misunderstood or commented something wrongly :)
src/main/java/TiTi.java
Outdated
@@ -0,0 +1,36 @@ | |||
import TiTi.util.SavedHistory; |
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.
According to the coding standard, every class should be part of some package. Perhaps package titi;
@@ -0,0 +1,41 @@ | |||
package TiTi.task; |
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.
According to the coding standard, names representing packages should be in all lower case. So in this case, perhaps package titi.task;
? This applies to the other files as well.
src/main/java/TiTi/util/Parser.java
Outdated
import TiTi.task.Task; | ||
import TiTi.task.Event; | ||
import TiTi.task.Deadline; | ||
import TiTi.task.ToDo; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Scanner; |
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.
Not sure if there is a fixed import order convention, but I think as long as it is consistent throughout the project, it is alright. According to this link, the above import is reversed.
* Contain the task to be printed (if needed). | ||
*/ | ||
public class Response { | ||
public enum Cue {EXIT, LIST, DONE, DELETE, TASKERROR, TODO, 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.
Not sure if enum names should have underscore to separate two words, as in like constants.
* | ||
* @return size of list | ||
*/ | ||
public int 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.
According to the coding standards, names representing methods must be verbs. So perhaps getSzie
?
src/main/java/TiTi/util/Ui.java
Outdated
/** | ||
* Prints the response for the user command onto the user interface. | ||
*/ | ||
public void userCommand() { |
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.
Similarly, perhaps printUserCommand
?
} | ||
|
||
@Test | ||
public void DateTest(){ |
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.
According to coding standards, names representing methods must be verbs and written in camelCase. So perhaps testDate()
?
import TiTi.task.Deadline; | ||
import org.junit.jupiter.api.Test; |
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.
Regardless of the import order, I think there should be a new line separate these two imports as they are from different sources.
* Contain String description of the task. | ||
* Contain String description of the date of task. | ||
* Contain LocalDate object of the date of task (if applicable). | ||
* Contain boolean value of whether the task has been completed. |
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.
Should be Contains
instead of Contain
. These are probably overlooked but I noticed the same issue in several other places too.
protected LocalDate date; | ||
|
||
/** | ||
* Constructor for Deadline class. |
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.
Not sure if nouns are allowed. If not, perhaps can put Constructs a Deadline instance.
?
Package the app as an executable JAR file so that it can be distributed easily.
Input description from user when adding tasks might be empty. If so, response would be taken care in UI response. Hence tasks with empty description should not be created. * Assertion test is used to stop program if attempt to initialise empty description tasks
Examines the code and refactor to improve the code quality where necessary: * break long method into smaller sub-methods * improve variable naming * improve documentation style * other slight changes
Improve code quality
* branch-A-CodeQuality: Improve code quality.
Provide a way to perform tasks on multiple items: * Multiple tasks can be deleted at once * Multiple tasks can be marked done at once
changes to: *package naming *fix header comments for TiTi.main()
* 'master' of https://github.com/zhing22/ip: Set theme jekyll-theme-merlot
Includes a quick description of TiTi Chatbot, and a list of all usages and commands
* Wrong picture namings * Problem with running program * Problems with delete and done functionalites
TiTi Catbot
TiTi Catbot frees your mind of having to remember things you need to do. It's,
All you need to do is,
And it is FREE!!!
Features:
If you are programmer Ling Ling, you can use it to practice Java 40 hours a day too. Here's the
main
method: