Skip to content
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

Open
wants to merge 39 commits into
base: master
Choose a base branch
from
Open

Conversation

shadowezz
Copy link

No description provided.

Copy link

@sigmund-c sigmund-c left a 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

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 {

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

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 Commands!

Comment on lines 11 to 14
private final static String line = "______________________________________________________";
private final static String lineIndent = " ";
private final static String listIndent = " ";
private final static String textIndent = " ";

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, ...)

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!

Copy link
Author

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!

Copy link

@sc-arecrow sc-arecrow left a 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 {

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 Commands!

* @param task the task that needs to be converted to string format
* @return the string format of input task
*/
private String formatTask(Task task) {

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];

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 :)

Comment on lines 11 to 14
private final static String line = "______________________________________________________";
private final static String lineIndent = " ";
private final static String listIndent = " ";
private final static String textIndent = " ";

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",

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;

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;

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?

Comment on lines +4 to +6
TODO,
DEADLINE,
EVENT;

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!

Copy link
Author

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!

Copy link

@yuki-cell yuki-cell left a 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.

import duke.exception.MissingInformationException;

import java.io.IOException;

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 {

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) {

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;


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;

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 {

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants