-
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
[Cao Wenjie] iP #351
base: master
Are you sure you want to change the base?
[Cao Wenjie] iP #351
Conversation
# Please enter a commit message to explain why this merge is necessary, # especially if it merges an updated upstream into a topic branch. # # Lines starting with '#' will be ignored, and an empty message aborts # the commit.
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, a very neatly written project! Only found minor violations to the coding standard.
* Creates an instance of Duke. | ||
* It initialises the UI, creates a storage based on the filepath | ||
* and initialises the existing tasks. | ||
* @param filePath The location where the task data is stored |
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.
Minor nitpick (that I'm personally ok with), but the coding standard suggests adding an empty line between the description and the parameter section
* It stores the user's command in the form of an array to separate | ||
* the different components of the command. | ||
*/ | ||
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.
Not 100% sure about this one myself, but would a name like ParsedCommand
be more accurate here since it represents one command? Though I understand that a previous level requires a class to be explicitly named Parser :P
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 Parser
is a suitable name for this class because its function is to decode user input and convert it into Command
s!
src/main/java/duke/Ui.java
Outdated
private final static String line = "______________________________________________________"; | ||
private final static String lineIndent = " "; | ||
private final static String listIndent = " "; | ||
private final static String textIndent = " "; |
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.
Since these are constants, it's recommended to have them all be uppercase (LINE, LINE_INDENT, ...). And perhaps that since they're associated with one another, they could also be prefixed with a common name (MSG_LINE, MSG_LINE_INDENT, ...)
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 naming constants as @sigmund-c suggested is compliant with coding standards!
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.
Yup I think both of you are right! Thanks for the suggestions!
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, your code is very clean and readable! I was trying my best to look for improvements in naming and coding standard violations but I only found a handful :)
* It stores the user's command in the form of an array to separate | ||
* the different components of the command. | ||
*/ | ||
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 Parser
is a suitable name for this class because its function is to decode user input and convert it into Command
s!
* @param task the task that needs to be converted to string format | ||
* @return the string format of input task | ||
*/ | ||
private String formatTask(Task 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.
I like your storage formatting! 👍
if (taskComponent[0].equals("T")) { | ||
taskList.add(new Todo(name, isComplete)); | ||
} else if (taskComponent[0].equals("D")) { | ||
String by = taskComponent[3]; |
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 it be clearer if this variable was named something like dateTimeString
? Same for Line 126 :)
src/main/java/duke/Ui.java
Outdated
private final static String line = "______________________________________________________"; | ||
private final static String lineIndent = " "; | ||
private final static String listIndent = " "; | ||
private final static String textIndent = " "; |
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 naming constants as @sigmund-c suggested is compliant with coding standards!
import java.util.List; | ||
|
||
public class DateFormat { | ||
public static List<String> dateFormats = Arrays.asList("d/M/yy HHmm", "d-M-yy 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.
I like that you check for many possible date formats! 👍
* Represents a deadline type of task that contains an additional due date. | ||
*/ | ||
public class Deadline extends Task { | ||
protected Date 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 a better name for this variable could be dueDate
?
* Represents an event type of task with the date of event. | ||
*/ | ||
public class Event extends Task { | ||
protected Date at; |
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 better name for this variable could be eventDate
?
TODO, | ||
DEADLINE, | ||
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 think according to the coding standard, enum names should be written in PascalCase!
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 am not really sure on this myself but I thought enum name refers to TaskType instead. I will double check!
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, code was very organized and easy to follow.
Some cosmetic changes and suggestion for task's constructor requested.
src/main/java/duke/Duke.java
Outdated
import duke.exception.MissingInformationException; | ||
|
||
import java.io.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.
maybe can delete this extra space
* @throws DateException If the date of tasks in the file are of the wrong format. | ||
*/ | ||
public List<Task> load() throws IOException, DateException { | ||
|
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 can delete this extra space?
* @param isComplete the completion status of deadline | ||
* @param by the due date of deadline | ||
*/ | ||
public Deadline(String name, boolean isComplete, Date 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.
maybe set isComplete false by default so no need to assign isComplete every time making deadline (same applies for other task related class)
ex) new Deadline("task", false, 2020-9-1) => new Deadline("task", 2020-9-1)
import org.junit.jupiter.api.Test; | ||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
|
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 is minor detail but can remove this extra space
@@ -0,0 +1,42 @@ | |||
package duke; | |||
|
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 delete extra space
* @throws DateException If the date provided is of the wrong format. | ||
* @throws DukeException If the user command is invalid. | ||
*/ | ||
public static Command parse(String fullCommand) throws MissingInformationException, DateException, 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.
maybe can make each command's string as enum?
Add assertions to Parser and TaskList methods
# Conflicts: # src/main/java/duke/TaskList.java
Improve code quality and allow gui to exit after user types bye
Implement sorting of tasks
No description provided.