-
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
[Chuyue] iP #349
base: master
Are you sure you want to change the base?
[Chuyue] iP #349
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.
Might want to review the longer methods and try to split up responsibilities more.
src/main/java/Command.java
Outdated
@@ -0,0 +1,10 @@ | |||
public enum Command { | |||
blank, |
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 change the constants to all caps? e.g. BLANK, CLEAR, etc.
src/main/java/Deadline.java
Outdated
this.deadline = deadline; | ||
} | ||
public String toString() { | ||
String donez; |
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.
Might want to change the variable name to something clearer?
src/main/java/Deadline.java
Outdated
} | ||
public String toString() { | ||
String donez; | ||
if (done) { |
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.
"done" seems like a boolean value, maybe try "isDone"?
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.
boolean method can be named isDone() instead.
src/main/java/Duke.java
Outdated
/** | ||
* Contains most of the chat bot logic | ||
*/ | ||
public void run() { |
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 extract out certain parts into helper methods? Currently this method seems too long and will only grow longer as more logic is added.
src/main/java/Duke.java
Outdated
} else { | ||
task = tasks.get(current); | ||
tasks.delete(current); | ||
Ui.print("i've removed the following task from the list:\n\t" + task + "\nnow you have " + tasks.size() + " items in your 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.
Maybe split up this line as it is too long?
* @param in The string to be parsed. | ||
* @return The task required by the input string. | ||
*/ | ||
public static Task getTask(String in) { |
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.
Again, maybe consider breaking the method up into several smaller ones?
List<Task> result = new ArrayList<Task>(); | ||
File myObj = new File(filePath); | ||
Scanner myReader; | ||
try { |
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 code block is getting close to an arrowhead style! Maybe try to refrain nesting too many try blocks?
src/main/java/Task.java
Outdated
if (taskType.equals("T")) { | ||
tempTask = new ToDo(result[2]); | ||
} else if (taskType.equals("D")) { | ||
tempTask = new Deadline(result[2],LocalDateTime.parse(result[3],DateTimeFormatter.ofPattern("dd MMM yyyy HHmm"))); |
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.
Parameters look quite long and there's many magic numbers, maybe split up the lines and use constants?
src/main/java/Ui.java
Outdated
* Prints an error message with the associated formatting. | ||
* @param msg The message to be printed. | ||
*/ | ||
public static void errorMsg(String msg) { |
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 change the method name to "printErrorMsg"?
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 change the method name to "printErrorMessage" or "printErrorMsg" as mentioned by Zhi Yuan.
src/test/java/DukeTest.java
Outdated
@Test | ||
public void parserTestReturnError(){ | ||
assertEquals(Parser.parse("dfgjdhg"), Command.error); | ||
assertEquals(Parser.parse("todo"), Command.error); |
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 does parsing "todo" and "event" expect an error command?
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 job! Java OOP adhered!
src/main/java/Command.java
Outdated
@@ -0,0 +1,10 @@ | |||
public enum Command { | |||
blank, | |||
clear, |
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 it these enum constants be in all caps?
src/main/java/Deadline.java
Outdated
} | ||
public String toString() { | ||
String donez; | ||
if (done) { |
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.
boolean method can be named isDone() instead.
src/main/java/Duke.java
Outdated
+ "| |_| | |_| | < __/\n" | ||
+ "|____/ \\__,_|_|\\_\\___|\n"; | ||
System.out.println("Hello from\n" + logo); | ||
new Duke("duke.txt").run(); |
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.
Very clean psvm method!
src/main/java/Event.java
Outdated
|
||
public class Event extends Task { | ||
private LocalDateTime startDate; | ||
public Event(String in, LocalDateTime start) { |
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 line space between properties and the class constructor.
|
||
public class Deadline extends Task { | ||
private LocalDateTime deadline; | ||
public Deadline(String in, LocalDateTime 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 a line space between properties and class constructor.
public class Parser { | ||
/** | ||
* Converts the string to a type of command. | ||
* @param in The string to be parsed. |
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 add a space between Javadoc description and @param (line 6 and 7).
src/main/java/Task.java
Outdated
import java.time.format.DateTimeFormatter; | ||
|
||
public class Task { | ||
protected boolean done; |
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 boolean can be named "isDone"?
} | ||
|
||
/** | ||
* Converts tasks in taskList to String format. |
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 leave a line space between line 43 and line 44
src/main/java/Ui.java
Outdated
* Prints an error message with the associated formatting. | ||
* @param msg The message to be printed. | ||
*/ | ||
public static void errorMsg(String msg) { |
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 change the method name to "printErrorMessage" or "printErrorMsg" as mentioned by Zhi Yuan.
A-Assertions
A-CodeQuality
Add comments and abstract out some methods and constants
No description provided.