Skip to content

[Nguyen D.Q. Minh] iP#450

Open
nguyendqminh wants to merge 27 commits into
nus-cs2103-AY2021S1:masterfrom
nguyendqminh:master
Open

[Nguyen D.Q. Minh] iP#450
nguyendqminh wants to merge 27 commits into
nus-cs2103-AY2021S1:masterfrom
nguyendqminh:master

Conversation

@nguyendqminh
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown

@afroneth afroneth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job! The overall code quality is high. However, there is a need to refactor some small code style violations.

public String toString() {
return String.format("[D]%s (by: %s)", super.toString(), this.by);
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the clean code here. Is it perhaps better to rename the variable "by" to something clearer?

Comment thread src/main/java/Duke.java Outdated
}

public static void main(String[] args) throws Exception {
new Duke().execute();
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good usage of OOP principles!

Comment thread src/main/java/Duke.java Outdated
Parser parser = new Parser(command);
String commandType = parser.getCommandType();
switch (commandType) {
case "bye": {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't there be no indentation for case clauses?

Comment thread src/main/java/Parser.java
private String commandType;
private int index;

public Parser(String command) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there too much usage of if-else loops here?

Comment thread src/main/java/Storage.java Outdated
BufferedWriter writer = Files.newBufferedWriter(this.filePath);
writer.write(String.valueOf(tasks.size()));
writer.newLine();
for(Task task : tasks) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should there be a white space character after 'for'?

Comment thread src/main/java/Storage.java Outdated
openFile();
BufferedReader reader = Files.newBufferedReader(this.filePath);
int taskCount = Integer.parseInt(reader.readLine());
for(int i = 0; i < taskCount; ++i) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should there be a white space character after 'for'?

boolean isDone = (status.equals("[O]"));
Task result;

switch (taskType) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't there be no indentation for case clauses?

throw new DukeException("Error while loading data.");
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is line 35 (blank statement) removable?

Copy link
Copy Markdown

@Asuraxsoul Asuraxsoul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, I feel that your code mostly complies to the coding standards specified, and I feel that there are only a few minor tweaks here and there required.

Good job for designing your duke program in a way that it is very easy to read and understand! 👍

Comment thread src/main/java/Deadline.java Outdated
@@ -0,0 +1,18 @@
public class Deadline extends Task {
protected String by;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you can change "by" variable name to be more descriptive? Can consider "timeDescription"?

Comment thread src/main/java/Event.java Outdated
@@ -0,0 +1,18 @@
public class Event extends Task {
protected String at;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to Deadline class, could the "at" variable name be changed to something more descriptive?

Comment thread src/main/java/Parser.java Outdated
throw new DukeException(":( OOPS!!! The description of an event cannot be empty.");
}
String rest = command.substring(6);
int at_position = rest.indexOf("/at ");
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should underscore be used for naming here? According to the coding standards, underscores may be used in test method names and for constant names that are all caps (eg, MAX_ITERATIONS).

Comment thread src/main/java/Task.java
}

private String getStatusIcon() {
return isDone ? "O" : "X";
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider storing "O" and "X" as constants and then referring to them?

Comment thread src/main/java/Task.java Outdated
public String toString() {
return String.format("[%s] %s", this.getStatusIcon(), this.description);
}
} No newline at end of file
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel that it would be better to add 1 empty line at the end of this file so that git knows that the file terminates here.

Comment thread src/main/java/UI.java
System.out.println(e.getMessage());
}

public void greetings() {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can consider changing "greetings" method name to a verb form such as "greet".

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.

3 participants