-
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
[Yong Kang] iP #283
base: master
Are you sure you want to change the base?
[Yong Kang] iP #283
Conversation
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! The code was really good and followed the coding standard like having private variables and line breaks at operators. Perhaps comments could be added to public methods? Overall, it was really nice.
src/main/java/Parser.java
Outdated
import java.time.format.DateTimeFormatter; | ||
|
||
public class Parser { | ||
|
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 think public methods should have comments?
src/main/java/Parser.java
Outdated
String[] parsed = input.split(" ", 2); | ||
String keyword = parsed[0]; | ||
String body = ""; | ||
if (parsed.length > 1) body = parsed[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.
I think if else statements should have curly brace?
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, the naming of variables and classes are appropriate 👍
Maybe the method names could be more consistent with the coding standard. (Beginning with a verb)
src/main/java/Storage.java
Outdated
file = new File(filepath); | ||
} | ||
|
||
public ArrayList<Task> load() throws FileNotFoundException, DukeException { |
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.
Would a more descriptive method name be more suitable here?
src/main/java/Storage.java
Outdated
} | ||
} | ||
|
||
public void write(TaskList tasks) 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.
Would a more descriptive method name be more suitable here? Perhaps writeFile?
src/main/java/Parser.java
Outdated
private static String desc(String body) { | ||
return body.split(" /", 2)[0]; | ||
} |
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 starting the method with a verb? An example can be getDesc.
src/main/java/Parser.java
Outdated
private static String deadline(String body) { | ||
String time = body.split(" /by ", 2)[1]; | ||
if (time.equals("now")) { | ||
return LocalDate.now().format(DateTimeFormatter.ofPattern("d MMM yyyy")); | ||
} else { | ||
return LocalDate.parse(time).format(DateTimeFormatter.ofPattern("d MMM yyyy")); | ||
} | ||
} |
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 starting the method with a verb? An example can be getDeadline.
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 think your code is a very good example of OOP principles and everything is nicely abstracted! Just have to take note of the brackets, other than that I have a lot to learn from your code design!
src/main/java/Parser.java
Outdated
* @throws DukeException When user input cannot be understood. | ||
*/ | ||
public static void parseInput(String input, Ui ui, TaskList tasks, Storage storage) throws DukeException, IOException { | ||
String[] parsed = input.split(" ", 2); |
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 didn't know you can do this! Nice 👍
src/main/java/Parser.java
Outdated
* @return A boolean whether input is bye. | ||
*/ | ||
public static boolean isBye(String input){ | ||
return input.split(" ", 2)[0].equals("bye"); |
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.
just a small suggestion, maybe you can mention that input.split(...)[0] is the firstWord of the input by creating a variable so it's slightly clearer!
src/main/java/TaskList.java
Outdated
noneFound = false; | ||
} | ||
} | ||
if (noneFound) ui.say("No matching tasks."); |
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 think you can add in brackets based on the coding standards, but your code is really neat!
Test commit
Merge PR Branch A code quality
Implement B-Snooze
Add JavaDoc comments
No description provided.