Skip to content

[Mark Lin] iP#66

Open
marklin2234 wants to merge 24 commits into
nus-cs2113-AY2324S1:masterfrom
marklin2234:master
Open

[Mark Lin] iP#66
marklin2234 wants to merge 24 commits into
nus-cs2113-AY2324S1:masterfrom
marklin2234:master

Conversation

@marklin2234

Copy link
Copy Markdown

No description provided.

@marklin2234 marklin2234 changed the title marklin [Mark Lin] iP Sep 4, 2023

@woodenclock woodenclock 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,
Appropriate use of indentation for the wrapped lines.
Good use of the if-else structure, as stated in the coding standards.

Comment thread src/main/java/Duke.java Outdated
Comment thread src/main/java/Deadline.java Outdated
Comment thread src/main/java/Event.java Outdated

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

Good job, naming was done well and the code was easy to read.

Comment thread src/main/java/Duke.java Outdated
Comment thread src/main/java/Duke.java Outdated
Comment thread src/main/java/Event.java Outdated
Comment thread src/main/java/Todo.java Outdated
Comment thread src/main/java/Deadline.java Outdated
Comment thread src/main/java/Task.java Outdated

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

Great progress on your iP so far, I have left some comments for potential areas of improvement, especially regarding code quality :)

Comment thread src/main/java/Duke.java Outdated
out = "List is empty.";
}
for (int i = 0; i < listAsArray.length; i++) {
out += (i == 0 ? "" : "\n") + (i + 1) + ". " + listAsArray[i].getListText();

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 avoid complicated expressions such as this, consider especially the usage of ternary operators in such contexts, as more complicated comparisons may affect the code readability.

Comment thread src/main/java/Duke.java Outdated
Comment on lines +81 to +101
switch (line[0]) {
case "T": {
Task task = new Todo(taskName);
task.setIsComplete(isMark);
list.add(task);
break;
}
case "D": {
String by = line[3];
Task task = new Deadline(taskName, by);
task.setIsComplete(isMark);
list.add(task);
break;
}
case "E": {
String from = line[3].split("-")[0];
String to = line[3].split("-")[1];
Task task = new Event(taskName, from, to);
task.setIsComplete(isMark);
list.add(task);
break;

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 further abstracting out the logic in this portion of the code to avoid deep nesting

Comment thread src/main/java/Duke.java Outdated
Comment on lines +96 to +97
String from = line[3].split("-")[0];
String to = line[3].split("-")[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.

Try to avoid usage of magic literals, especially in larger projects, in this case, consider assigning your delimiter to a variable, then referencing when needed.

Comment thread src/main/java/Duke.java Outdated
throw new DukeException("The description of " + command + " cannot be empty.");
}
return message.substring(command.length(),
message.contains("/") ? message.indexOf("/") : message.length()).trim();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Similarly, keep aware of the usage of magic literals.

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