Skip to content

[Sebastian Soewanto] iP#205

Open
SebastianSoewanto wants to merge 22 commits into
nus-cs2113-AY2223S2:masterfrom
SebastianSoewanto:master
Open

[Sebastian Soewanto] iP#205
SebastianSoewanto wants to merge 22 commits into
nus-cs2113-AY2223S2:masterfrom
SebastianSoewanto:master

Conversation

@SebastianSoewanto

Copy link
Copy Markdown

Up to level 3

@DavidVin357 DavidVin357 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.

LGTM, just several naming proposals :)
Also, maybe consider switch case instead of lots if else statements. Some comments for explaining specific variables might also be nice.
Overall, it's fine in terms of code standard.

Comment thread src/main/java/Duke.java Outdated
+ "| |_| | |_| | < __/\n"
+ "|____/ \\__,_|_|\\_\\___|\n";

String line = "____________________________________________________\n";

@DavidVin357 DavidVin357 Feb 1, 2023

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Seems like it is a constant, so maybe consider using static final LINE_DIVIDER (or some other similar name)?

Comment thread src/main/java/Duke.java Outdated
String line = "____________________________________________________\n";
System.out.println("Hello from\n" + logo);
System.out.print(line + "Hello! I'm Duke\n" + "What can I do for you?\n" + line);
String[] list = new String[100];

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 think you use this list to store the different tasks, so maybe it's better to name it as tasks? :)

Comment thread src/main/java/Duke.java Outdated
String[] list = new String[100];
boolean[] isDone = new boolean[100];
String toFill;
int listCount = 0;

@DavidVin357 DavidVin357 Feb 1, 2023

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 something like tasksCount can tell better on what you are counting here?

Comment thread src/main/java/Duke.java Outdated
System.out.print(line + "Hello! I'm Duke\n" + "What can I do for you?\n" + line);
String[] list = new String[100];
boolean[] isDone = new boolean[100];
String toFill;

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 think naming it checkerContent or some other noun may better represent the meaning of the variable (verbs are more suitable to be used for the methods)

Comment thread src/main/java/Duke.java Outdated
else {
toFill = " ";
}
System.out.println(i + 1 + ". [" + toFill + "] " + list[i]);

@DavidVin357 DavidVin357 Feb 1, 2023

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Extracting i+1 to another line as i++ may make the code a little bit more clean)

Comment thread src/main/java/Duke.java Outdated
String line = "____________________________________________________\n";
System.out.println("Hello from\n" + logo);
System.out.print(line + "Hello! I'm Duke\n" + "What can I do for you?\n" + line);
String[] list = new String[100];

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Naming of ' String[ ] list ' is quite vague, maybe if possible to provide a more useful name for readability? e.g. ' String [ ] taskList '

Comment thread src/main/java/Duke.java Outdated
System.out.println(line + "Nice! I've marked this task as done:\n" + " [X] " + list[mark - 1]);
System.out.print(line);
} else if (input.startsWith("unmark")) {
int unmark = Integer.parseInt(input.substring(7));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The naming of ' unmark' is a bit confusing, maybe switch to ' taskToUnmark '?

Comment thread src/main/java/Duke.java Outdated
isDone[unmark - 1] = false;
System.out.println(line + "OK, I've marked this task as not done yet:\n" + " [ ] "+ list[unmark - 1]);
System.out.print(line);
} else if(input.equals("list")) {

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 indentation and presenting the conditional statements, which helps the code's readability.

Comment thread src/main/java/Duke.java Outdated
+ "|____/ \\__,_|_|\\_\\___|\n";

String line = "_________________________________\n";
String line = "____________________________________________________\n";

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Naming can be changed to avoid confusion down the code block, could change to -> e.g. 'static final String margin' (since its a repeating string pattern to be printed out)

@ghzr0 ghzr0 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.

Commented about code's quality

@bdthanh bdthanh 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.

You should use the correct tag name so that your progress is recorded. Keep up the good work and try your best for all levels. Be careful with naming constants and list variable!
image

Comment thread src/main/java/Duke.java Outdated
String line = "____________________________________________________\n";
System.out.println("Hello from\n" + logo);
System.out.print(line + "Hello! I'm Duke\n" + "What can I do for you?\n" + line);
Task[] task = new Task[100];

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

since the number of task can be more than 100. you can consider to use the dynamic size array list

Comment thread src/main/java/Duke.java Outdated
Comment on lines +5 to +11
String logo = " ____ _ \n"
+ "| _ \\ _ _| | _____ \n"
+ "| | | | | | | |/ / _ \\\n"
+ "| |_| | |_| | < __/\n"
+ "|____/ \\__,_|_|\\_\\___|\n";

String line = "____________________________________________________\n";

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Constant should be named by CAPITAL LETTER for example String DIVIDER, String LOGO

Comment thread src/main/java/Duke.java Outdated
String line = "____________________________________________________\n";
System.out.println("Hello from\n" + logo);
System.out.print(line + "Hello! I'm Duke\n" + "What can I do for you?\n" + line);
Task[] task = new Task[100];

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

task should be renamed to tasks (with s)

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.

4 participants