-
Notifications
You must be signed in to change notification settings - Fork 437
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
[Zhao Lingshan] iP #110
base: master
Are you sure you want to change the base?
[Zhao Lingshan] iP #110
Conversation
# Conflicts: # src/main/java/Deadline.java # src/main/java/Duke.java # src/main/java/Event.java
# Conflicts: # src/main/java/Parser.java
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.
Great, all codes followed the java coding standard!
src/main/java/Parser.java
Outdated
} | ||
|
||
public static void parseFind(String s) { | ||
|
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.
why is this method empty?
src/main/java/Ui.java
Outdated
|
||
public class Ui { | ||
|
||
private final 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.
Naming for final should be all capital letter?
src/main/java/Ui.java
Outdated
public void showAddedTask(Task task, int length) { | ||
length++; | ||
System.out.println("Got it. I've added this task:\n" + task + "\n" | ||
+ "Now you have " + length + " tasks in the list.\n"); |
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.
you can use ++ length on here directly instead of writing line 48
src/main/java/Ui.java
Outdated
public void showList(TaskList taskList) { | ||
for (int i = 0; i < taskList.taskListLength(); i++) { | ||
if (i == 0) { | ||
System.out.println("Here are the tasks in your list:\n"); |
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.
maybe you can write this outside the for loop before line 58?
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.
Yes, if you could write that line before line 58, then the conditional check will no longer be needed and the code will be easier to read.
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 like how readable and organized your code is!
The way you made a check for details after a command is also quite interesting. However,
I can't help but notice that as a result of the method you use, you use a lot of 'magic numbers'.
As in "a number that does not explain the meaning of the number" instead of a constant.
Maybe you could consider using several constants instead?
Other than that, your code LGTM!
src/main/java/Parser.java
Outdated
* @return an event. | ||
*/ | ||
public static Event parseEvent(String display) throws DukeException { | ||
if (display.length() == 5 || display.length() == 6) { // "event" or "event " |
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.
I like how you did the check for the command's follow-up details!
However, I can't help but notice you use a lot of numbers for your comparison and substrings. Is there any reason you do this instead of using a constant?
src/main/java/TaskList.java
Outdated
|
||
public void findTask(String display) { | ||
ArrayList<String> matches = new ArrayList<>(); | ||
String task = display.substring(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.
Like previous, is there any reason you avoid using a constant for your substring() method calls?
src/main/java/Ui.java
Outdated
public void showList(TaskList taskList) { | ||
for (int i = 0; i < taskList.taskListLength(); i++) { | ||
if (i == 0) { | ||
System.out.println("Here are the tasks in your list:\n"); |
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.
Yes, if you could write that line before line 58, then the conditional check will no longer be needed and the code will be easier to read.
src/main/java/Storage.java
Outdated
|
||
public Task readFiles(String data) throws DukeException { | ||
if (data.startsWith("T")) { | ||
String description = data.substring(8); |
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.
Any reason why you don't use a constant?
A-CodeQuality
A-Assertions
No description provided.