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

[Kuek Yan Ling] iP #248

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

Conversation

yanlingkuek
Copy link

No description provided.

System.out.println("added: " + input);
} else {
for (int i = 1; i <= lst.size(); i++) {
System.out.println(i + ". " + lst.get(i-1));

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

@@ -1,10 +1,189 @@
import java.util.*;

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? (:

}


static void level2() {

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? (:


}


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

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


protected String deadline;

public DeadlineTask(String description, String deadlline) {

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.

@@ -1,10 +1,189 @@
import java.util.*;

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.

public class Duke {

static void level1() {

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.

System.out.println("added: " + input);
} else {
for (int i = 1; i <= lst.size(); i++) {
System.out.println(i + ". " + lst.get(i-1));

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.

}


static void level3() {

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.



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

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.


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

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.

}
} else if (inputArray[0].equals("todo") || inputArray[0].equals("deadline") || inputArray[0].equals("event")) { //adding a task
Task task = new Task("");
String[] inputArr1;

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.

@@ -0,0 +1,21 @@
public class Task {
protected String description;
protected boolean isDone;

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.


protected String deadline;

public DeadlineTask(String description, String deadlline) {

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.

public class Duke {

static void level1() {

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?

Scanner sc = new Scanner(System.in);
String input = sc.nextLine();

List<String> lst = new ArrayList<>();

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.

@@ -0,0 +1,15 @@
public class DeadlineTask extends Task {

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