Skip to content

[Chan Jing Rong] Duke Increments#346

Open
rongrongrr wants to merge 37 commits intonus-cs2103-AY1920S1:masterfrom
rongrongrr:master
Open

[Chan Jing Rong] Duke Increments#346
rongrongrr wants to merge 37 commits intonus-cs2103-AY1920S1:masterfrom
rongrongrr:master

Conversation

@rongrongrr
Copy link
Copy Markdown

No description provided.

@chrischenhui
Copy link
Copy Markdown

I like your commit messages. They all begin with a base verb and are very informative and consistent.

Copy link
Copy Markdown

@chrischenhui chrischenhui left a comment

Choose a reason for hiding this comment

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

Your import lines should not have new lines between them

Copy link
Copy Markdown

@chrischenhui chrischenhui left a comment

Choose a reason for hiding this comment

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

I like the overall structure of your code. Keep up the good work :)

Comment thread src/main/java/Ui.java Outdated
public void execute(TaskList tasks) {
String command = scanner.nextLine();
showLine();
if (command.equals("bye")) {
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 using switches if the if else statements get too messy


public class Deadline extends Task {
private String name;
private boolean done;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Should change done to isDone() to follow variable naming.

Comment thread src/main/java/Parser.java

public Parser() {

}
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 can choose not to type out the constructor method

task = new Deadline(words[2], words[3]);
} else {
task = new Event(words[2], words[3]);
}
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 using switch if your if-else statements are long

Comment thread src/main/java/Task.java Outdated
@@ -0,0 +1,37 @@
public abstract class Task {
private String name;
private boolean done;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Done can be renamed isDone

Comment thread src/main/java/Task.java Outdated
@@ -0,0 +1,37 @@
public abstract class Task {
private String name;
private boolean done;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Name and done should be protected instead, so that classes that extends it can use it

Comment thread src/main/java/Todo.java
@@ -0,0 +1,17 @@
public class Todo extends Task {
private String name;
private boolean done;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Should not recreate a new private variable in Todo. Instead use Task's protected isDone and name

Comment thread src/main/java/Todo.java

@Override
public String toString() {
return String.format("[T]%s", super.toString());
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 like the use of String.format() here

Comment thread src/main/java/Ui.java Outdated
int index = Integer.valueOf(commands[1]) - 1;
System.out.println(" " + tasks.getTasks().get(index).toString());
tasks.delete(index);
System.out.println(String.format(" Now you have %d tasks in the list.", tasks.getTasks().size()));
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 you are reusing tasks.getTasks() multiple times, consider creating a variable just to store the reference

Comment thread src/main/java/Ui.java Outdated
System.out.println();
}

public void execute(TaskList tasks) {
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 like the naming of the parameter : tasks, as it suggest it is a list, not one item

Comment thread src/main/java/Task.java
* @return Formatted description of task.
*/
@Override
public String toString() {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good work in abstracting common parts of code and using it in subclasses with super()

Comment thread src/main/java/Ui.java
}

Task task;
if (commands[0].equals("todo") || commands[0].equals("deadline") || commands[0].equals("event")) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Since lines are getting long and commands[0] is used multiple times, maybe assign String move = commands[0] and use move for proceeding lines?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants