Skip to content

[Kuek Yan Ling] iP#248

Open
yanlingkuek wants to merge 44 commits into
nus-cs2103-AY2021S2:masterfrom
yanlingkuek:master
Open

[Kuek Yan Ling] iP#248
yanlingkuek wants to merge 44 commits into
nus-cs2103-AY2021S2:masterfrom
yanlingkuek:master

Conversation

@yanlingkuek
Copy link
Copy Markdown

No description provided.

Comment thread src/main/java/Duke.java Outdated
System.out.println("added: " + input);
} else {
for (int i = 1; i <= lst.size(); i++) {
System.out.println(i + ". " + lst.get(i-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.

Perhaps there should be whitespace on the left and right of the "-" sign? (:
list.get(i - 1);

Comment thread src/main/java/Duke.java Outdated
@@ -1,10 +1,189 @@
import java.util.*;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Perhaps imported classes should be listed explicitly? (:

Comment thread src/main/java/Duke.java Outdated
}


static void level2() {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Perhaps the method names could be more descriptive? In verb form? (:

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

}


Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Perhaps more javadoc comments for the methods? (:

Copy link
Copy Markdown

@markuz5116 markuz5116 left a comment

Choose a reason for hiding this comment

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

I personally think that access modifier should be included for all methods so that readers can know whether the method should be accessed from outside the class, can be clearer for the readers.

Comment thread src/main/java/DeadlineTask.java Outdated

protected String deadline;

public DeadlineTask(String description, String deadlline) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Perhaps there is a typo for a variable name for deadline rather than deadlline.

Comment thread src/main/java/Duke.java Outdated
@@ -1,10 +1,189 @@
import java.util.*;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

importing tasks individually can be clearer.

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

public class Duke {

static void level1() {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Perhaps having a method name that briefly describes what it does would be clearer.

Comment thread src/main/java/Duke.java Outdated
System.out.println("added: " + input);
} else {
for (int i = 1; i <= lst.size(); i++) {
System.out.println(i + ". " + lst.get(i-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.

Not sure if I liked that the - does not have whitespace before and after it.

Comment thread src/main/java/Duke.java Outdated
}


static void level3() {
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 would personally an access modifier for my method to show whether it can be used outside the package or class.

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


static void level3() {
List<Task> lst = new ArrayList<>();
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Perhaps instead of lst, using tasks could be clearer to know what the list contains.

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

Scanner sc = new Scanner(System.in);
String input = sc.nextLine();
String[] inputArray = input.split(" ");
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

perhaps rather than inputArray, you can have a plural form of the input to show that it has multiple parts.

Comment thread src/main/java/Duke.java Outdated
}
} else if (inputArray[0].equals("todo") || inputArray[0].equals("deadline") || inputArray[0].equals("event")) { //adding a task
Task task = new Task("");
String[] inputArr1;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

perhaps extracting all the code that deals with different types of tasks could make your code clearer.

Comment thread src/main/java/Task.java Outdated
@@ -0,0 +1,21 @@
public class Task {
protected String description;
protected boolean isDone;
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 name of this boolean, clearly tells me what it does.

Comment thread src/main/java/DeadlineTask.java Outdated

protected String deadline;

public DeadlineTask(String description, String deadlline) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Perhaps there can be Javadoc comments to tell readers how this method works.

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

public class Duke {

static void level1() {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Perhaps it would be clearer if this method name starts with a verb?

Comment thread src/main/java/Duke.java Outdated
Scanner sc = new Scanner(System.in);
String input = sc.nextLine();

List<String> lst = new ArrayList<>();
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Perhaps the parameter name can be something like commands? lst may sound a bit unclear to readers.

Comment thread src/main/java/DeadlineTask.java Outdated
@@ -0,0 +1,15 @@
public class DeadlineTask extends Task {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Maybe you can consider putting classes into packages.

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