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

[Mark Lin] iP #66

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

Conversation

marklin2234
Copy link

No description provided.

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

@woodenclock woodenclock left a comment

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.

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

@lctxct lctxct 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, naming was done well and the code was easy to read.

src/main/java/Duke.java Outdated Show resolved Hide resolved
src/main/java/Duke.java Outdated Show resolved Hide resolved
src/main/java/Event.java Outdated Show resolved Hide resolved
src/main/java/Todo.java Outdated Show resolved Hide resolved
src/main/java/Deadline.java Outdated Show resolved Hide resolved
src/main/java/Task.java Outdated Show resolved Hide resolved
Copy link

@exetr exetr left a comment

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 :)

out = "List is empty.";
}
for (int i = 0; i < listAsArray.length; i++) {
out += (i == 0 ? "" : "\n") + (i + 1) + ". " + listAsArray[i].getListText();
Copy link

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 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

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 on lines 96 to 97
String from = line[3].split("-")[0];
String to = line[3].split("-")[1];
Copy link

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.

throw new DukeException("The description of " + command + " cannot be empty.");
}
return message.substring(command.length(),
message.contains("/") ? message.indexOf("/") : message.length()).trim();
Copy link

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