Skip to content

[antrikshdhand] iP#72

Open
antrikshdhand wants to merge 30 commits into
nus-cs2113-AY2324S1:masterfrom
antrikshdhand:master
Open

[antrikshdhand] iP#72
antrikshdhand wants to merge 30 commits into
nus-cs2113-AY2324S1:masterfrom
antrikshdhand:master

Conversation

@antrikshdhand

Copy link
Copy Markdown

No description provided.

Comment thread src/main/java/Herbert.java Outdated
public int processLine(String line) {
if (line.equalsIgnoreCase("bye")) {
sayGoodbye();
return 1;

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 this be changed to a boolean instead of a number to avoid magic number?

Comment thread src/main/java/Herbert.java Outdated
System.out.println("___________________________________________________________________________");
}

return 0;

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 this be changed to return 'false' instead of 0 to avoid magic number?

Comment thread src/main/java/Main.java Outdated
while (scan.hasNextLine()) {
line = scan.nextLine();

if (herbert.processLine(line) == 1) return;

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 this be separated into two lines to follow the coding standards?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yes, you're right. I'm not sure how I missed this 😅

Comment thread src/main/java/Herbert.java Outdated
System.out.println("___________________________________________________________________________");
}

public void sayGoodbye() {

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 job. I like how you named this method, which follows the coding standard.

@antrikshdhand

Copy link
Copy Markdown
Author

Thank you for reviewing my PR. I will update my code with your recommendations!

@maanyos maanyos left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Overall, good adherence to method & variable naming standard, with a few exceptions.
Code can be improved by applying OOP principles, such as inheritance and exceptions as taught in (future) lectures to improve clarity.
Lastly, avoid big classes that do a lot, try to split the components by their use.

Comment thread src/main/java/duke/Herbert.java Outdated
@@ -0,0 +1,291 @@
package duke;

import task.*;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

avoid wildcard imports

Comment thread src/main/java/duke/Herbert.java Outdated
+ "|__| |__||_______||___| |_||_______||_______||___| |_| |___| ";

System.out.println(System.lineSeparator() + logo);
System.out.println("___________________________________________________________________________");

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 refactoring this? seems to be used frequently

Comment thread src/main/java/duke/Herbert.java Outdated
System.out.println("___________________________________________________________________________");
System.out.println("\tHello! I'm Herbert." + System.lineSeparator() + "\tWhat can I do for you?");
System.out.println(System.lineSeparator() + "\tYou may choose from the following commands:");
for (Command s : Command.values()) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

try to use more meaningful variable names. can make code a lot clearer if the loop body is long

Comment thread src/main/java/duke/Herbert.java Outdated
System.out.println("###########################################################################");
}

public int processLine(String line) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

returning int from a processLine method isn't very informative

@@ -0,0 +1,68 @@
package duke;

public enum 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.

why the choice to use enum?

Comment thread src/main/java/duke/Herbert.java Outdated
return 0;
}

private void markTask(String line, boolean completed) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

follow boolean type naming standard

Comment thread src/main/java/duke/Main.java Outdated
Comment on lines +16 to +17
int process = herbert.processLine(line);
if (process == 1) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

clarity can be improved by using another return type as mentioned above

}

public String getStatusIcon() {
return (completed ? "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.

elaborating this line can improve readibility

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