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

[Cao] iP #466

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

[Cao] iP #466

wants to merge 70 commits into from

Conversation

Ringo1225
Copy link

No description provided.

Copy link

@Lingy12 Lingy12 left a comment

Choose a reason for hiding this comment

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

There is no violation of the coding standard. You follow the naming layout and comment. But could you try to pack the statement, especially for the output (eg. pack printing output format into a function, so that you can just call that function to print output, instead of using multiple lines to print the lines etc). Also, perhaps adding some comment in each logical block and some Javadoc can provide better documentation.

package main.java;

public class Deadline extends Task {
protected String deadline;

Choose a reason for hiding this comment

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

Suggest using private keyword instead of protected.

+ "| | | | | | | |/ / _ \\\n"
+ "| |_| | |_| | < __/\n"
+ "|____/ \\__,_|_|\\_\\___|\n";
System.out.println("Hello from\n" + logo);
System.out.println(" ____________________________________________________________");
System.out.println(" Hello! I'm Duke\n What can I do for you?");

Choose a reason for hiding this comment

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

different parts of the code can be grouped together as a method, make it easier for abstraction.

package main.java;

public class Event extends Task {
protected String time;

Choose a reason for hiding this comment

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

same suggestion as deadline

Copy link

@yuanxing-z yuanxing-z left a comment

Choose a reason for hiding this comment

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

Some suggestions are made as single comment in each file, overall the code quality is good. Feel free to reply if you have any questions regarding the comments.

while (true) {
String command = sc.next();
switch (command) {
case "bye":

Choose a reason for hiding this comment

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

There's no indention for the case statements. It should be 'aligned' with the switch statement.

try {
handleDone();
} catch (DukeException e) {
System.out.println(" ____________________________________________________________");

Choose a reason for hiding this comment

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

Maybe you could abstract out this border line as a variable, then call it whenever you need it. Makes the code tidy.

Comment on lines 99 to 123
public void handleDone() throws DukeException {
String doneCommand = sc.nextLine();
int index = 0;
if (doneCommand.isEmpty()) {
throw new DukeException("\u2639 OOPS!!! I need to know the index of the task to be done!");
}
try {
index = Integer.parseInt(doneCommand.stripLeading());
} catch (NumberFormatException e) {
System.out.println(" ____________________________________________________________");
System.out.println(" \u2639 Please enter a valid integer!!");
System.out.println(" ____________________________________________________________\n");
return;
}
if (index > taskList.size()) {
throw new DukeException("\u2639 Your number is too large!!");
}
Task currentTask = taskList.get(index - 1);
currentTask.markAsDone();
System.out.println(" ____________________________________________________________");
System.out.println(" Nice! I've marked this task as done:");
System.out.print(" ");
currentTask.printDescription();
System.out.println(" ____________________________________________________________\n");
}

Choose a reason for hiding this comment

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

Perhaps you could add appropriate line breaks to enhance readability

Comment on lines 126 to 149
String deleteCommand = sc.nextLine();
int index = 0;
if (deleteCommand.isEmpty()) {
throw new DukeException("\u2639 OOPS!!! I need to know the index of the task to be deleted!");
}
try {
index = Integer.parseInt(deleteCommand.stripLeading());
} catch (NumberFormatException e) {
System.out.println(" ____________________________________________________________");
System.out.println(" \u2639 Please enter a valid integer!!");
System.out.println(" ____________________________________________________________\n");
return;
}
if (index > taskList.size()) {
throw new DukeException("\u2639 Your number is too large!!");
}
Task currentTask = taskList.get(index - 1);
taskList.remove(index - 1);
System.out.println(" ____________________________________________________________");
System.out.println(" Noted! I've removed this task:");
System.out.print(" ");
currentTask.printDescription();
System.out.println(" Now you have " + taskList.size() + " tasks in the list.");
System.out.println(" ____________________________________________________________\n");
Copy link

@junhui-phoon junhui-phoon Sep 6, 2020

Choose a reason for hiding this comment

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

Same comment as above. Line breaks for readability.

Ringo1225 added 5 commits September 7, 2020 22:57
* branch-Level-7:
  solved the bug when the command.txt does not exist.
  Saved the list of tasks in a txt. file. Every time will load the data from the file.
* branch-Level-8:
  Stored Deadline data as java.time.LocalDate

# Conflicts:
#	src/main/java/CommandHandler.java
#	src/main/java/Deadline.java
Ringo1225 and others added 30 commits September 17, 2020 15:20
* branch-GUI:
  Add FXML
  Restructure project
  Finish GUI feature
  Improve GUI
  Add some GUI feature
  Edit build.gradle
  Revise project structure
* branch-A-CodeQuality:
  Improve code quality
  Add assertions
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