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

[Sim Qian Hui] iP #58

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

Conversation

qianz-z
Copy link

@qianz-z qianz-z commented Aug 29, 2022

No description provided.

Copy link

@AaaaaronC AaaaaronC left a comment

Choose a reason for hiding this comment

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

Good coding practices, only a few minor naming issues

printAddItemText(newTodo);
break;
case "deadline":
String[] taskWithDeadline = inputWords[1].split("/by ", 2);

Choose a reason for hiding this comment

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

collections can be named as plural to distinguish from Strings instead of String[]

printAddItemText(newDeadlineTask);
break;
case "event":
String[] eventTask = inputWords[1].split("/at ", 2);

Choose a reason for hiding this comment

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

same thing here, the naming for eventTask follows that of other Strings, which make it slightly confusing

return taskType;
}

public String printTask() {

Choose a reason for hiding this comment

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

code here can be condensed more

System.out.println("____________________________________________________________");
}

public static void printGreeting() {

Choose a reason for hiding this comment

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

good that helper functions are used to make code neater subsequently

src/main/java/Deadline.java Outdated Show resolved Hide resolved
Copy link

@shengiv shengiv 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, code quality was well-maintained. Good job.

System.out.println("____________________________________________________________");
}

public static void printGreeting() {
Copy link

Choose a reason for hiding this comment

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

Consider adding comments to describe what the method does

Comment on lines 54 to 66
if (previousIcon == "X") {
if (isDone) {
System.out.println("This task has already been marked!");
} else {
System.out.println("OK, I've marked this task as not done yet:");
}
} else {
if (!isDone) {
System.out.println("This task has already been unmarked!");
} else {
System.out.println("Nice! I've marked this task as done:");
}
}
Copy link

Choose a reason for hiding this comment

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

The code can be restructured to make the happy path unindented as much as possible.

Comment on lines 33 to 38
public static void printAddItemText(Task input) {
System.out.println("Got it. I've added this task:");
System.out.println(input.printTask());
System.out.println("Now you have " + taskSize + " tasks in the list.");
printHorizontalLine();
}
Copy link

Choose a reason for hiding this comment

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

Good job on extracting out the print statements to print methods

Comment on lines 100 to 106
case "deadline":
String[] taskWithDeadline = inputWords[1].split("/by ", 2);
String taskDescription = taskWithDeadline[0];
String taskDeadline = taskWithDeadline[1];
Deadline newDeadlineTask = new Deadline(taskDescription, 'D', taskDeadline);
addItem(newDeadlineTask);
printAddItemText(newDeadlineTask);
Copy link

Choose a reason for hiding this comment

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

Avoid varying levels of abstraction to improve readability

Copy link

@hughjazzman hughjazzman left a comment

Choose a reason for hiding this comment

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

Keep coding! 👍

printAddItemText(newTodo);
break;
case "deadline":
String[] taskWithDeadline = inputWords[1].split("/by ", 2);

Choose a reason for hiding this comment

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

Copy link

@hughjazzman hughjazzman left a comment

Choose a reason for hiding this comment

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

Here are some comments after your commits 👍

@@ -0,0 +1,213 @@
package Duke;

import Duke.Tasks.*;

Choose a reason for hiding this comment

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

Do list imported classes explicitly, you might have to change IntelliJ settings.

https://se-education.org/guides/conventions/java/basic.html#statements

}

private static void loadTasksToTasksList() {
try {

Choose a reason for hiding this comment

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

}
}

public static void main(String[] args) throws EmptyArgumentException, InvalidCommandFormatException, TaskListEmptyException, TaskNumberOutOfBoundsException, IOException, TaskNumberNotNumberException {

Choose a reason for hiding this comment

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

@@ -0,0 +1,8 @@
package Duke.Exceptions;
public class DukeException extends Exception {
// protected final String MESSAGE = "☹ OOPS!!! I'm sorry, but I don't know what that means :-(";

Choose a reason for hiding this comment

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

Comment on lines 13 to 17
if (markStatus.equals("marked")) {
return ERROR_MESSAGE + markStatus + "!";
} else {
return ERROR_MESSAGE + markStatus + "!";
}

Choose a reason for hiding this comment

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

Seems the if-else does not do anything?

Suggested change
if (markStatus.equals("marked")) {
return ERROR_MESSAGE + markStatus + "!";
} else {
return ERROR_MESSAGE + markStatus + "!";
}
return ERROR_MESSAGE + markStatus + "!";

} else {
System.out.println("Here are the tasks in your list:");
for (int i = 0; i < getTasksListSize(); i++) {
System.out.println((i+1) + "." + tasksList.get(i).taskStatusWithDescriptionText());

Choose a reason for hiding this comment

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

Consider adding space between operators.

Suggested change
System.out.println((i+1) + "." + tasksList.get(i).taskStatusWithDescriptionText());
System.out.println((i + 1) + "." + tasksList.get(i).taskStatusWithDescriptionText());

Operators should be surrounded by a space character.

https://se-education.org/guides/conventions/java/index.html#layout

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