Skip to content

[Wang Silang] iP#214

Open
JangusRoundstone wants to merge 26 commits into
nus-cs2113-AY2223S2:masterfrom
JangusRoundstone:master
Open

[Wang Silang] iP#214
JangusRoundstone wants to merge 26 commits into
nus-cs2113-AY2223S2:masterfrom
JangusRoundstone:master

Conversation

@JangusRoundstone

Copy link
Copy Markdown

No description provided.

@gurmankalkat gurmankalkat left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Overall, great job structuring the code. Some minor style issues.

Comment thread src/main/java/Duke.java Outdated
System.out.println("Sir, your task has been unmarked as requested.");
}

public static void printCurrentList(Task[] list, int numOfItems)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nice job making clear method and variable names!

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

public static void addList()
{

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Use K&R style brackets (as done in the exitLine method)

Comment thread src/main/java/Duke.java Outdated
if(line.startsWith("todo")){
newTask = new ToDos(line);
}
else if(line.startsWith("deadline")){

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

change the form of the if/else statements to match the coding standard:

if (condition) {
statements;
} else if (condition) {
statements;
} else {
statements;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Yeah, you can refer to this link [https://se-education.org/guides/conventions/java/basic.html] for if-else statement coding standards.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks guys!

Comment thread src/main/java/Duke.java Outdated
@@ -1,3 +1,8 @@
import jdk.jfr.Event;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

where/how is this used?

Comment thread src/main/java/Duke.java Outdated
if(line.startsWith("todo")){
newTask = new ToDos(line);
}
else if(line.startsWith("deadline")){

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Yeah, you can refer to this link [https://se-education.org/guides/conventions/java/basic.html] for if-else statement coding standards.

Comment thread src/main/java/Duke.java Outdated
Comment on lines +22 to +30
{
String line;
Scanner in = new Scanner(System.in);
line = in.nextLine();
while(!line.equals("bye")) {
System.out.println(line);
line = in.nextLine();
}
}

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'd want to indent the { } properly, like:
public static void echo(){

// your code
}

Comment thread src/main/java/Task.java
@@ -0,0 +1,31 @@
public class Task {
protected String taskLabel;

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 how you have added another variable called taskLabel.

This is actually clear while storing the data in it instead of explicitly typing [D] / [E] / [T] every time while printing the lists.

@Zemdalk Zemdalk left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Your indentation is really good. StringBuffer class is really useful, I like the way you use it to deal with strings. Maybe you can replace some "magic numbers" with constants to make your code more readable? Just some personal ideas.

Comment thread src/main/java/Deadlines.java Outdated
private String endTime;
private String taskLabel = "[D]";
public Deadlines (String input){
super(input.substring(9,input.indexOf('/') - 1)); // Sanitize input by removing "deadline" at the start

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Personally, maybe you can replace the number 9 with a constant to avoid "magic numbers"?

Like private static final int DEADLINE_LABEL = 9;?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Agreed. Thanks for the idea!

Comment thread src/main/java/Deadlines.java Outdated
super.setTaskLabel(taskLabel);
endTime = "(" + getEndTime(input) + ")";
}
// Method of StringBuffer operation taken from

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 way you use StringBuffer to operate on these strings, it's really useful.

@wamikamalik wamikamalik left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Great Job! A few nits here and there. Do take a look at my comments below.

Comment thread src/main/java/Duke/Duke.java Outdated
Comment on lines +46 to +54
public static void echo() {
String line;
Scanner in = new Scanner(System.in);
line = in.nextLine();
while (!line.equals("bye")) {
System.out.println(line);
line = in.nextLine();
}
}

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 remove methods that are not being used to reduce redundant code and improve readability.

Comment thread src/main/java/Duke/Duke.java Outdated
}
line = in.nextLine(); // read in next line of text
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Try to have less that 30 LOC for any method. You can split the contents of this method into multiple methods.

Comment thread src/main/java/Duke/Duke.java Outdated
System.out.println("Glad I could be of help!");
}

public static void addList() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Do remember to provide appropriate names to methods. The method below is not just adding a list or adding to a list.

}
return output;
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Good job refactoring the code!

@@ -0,0 +1,4 @@
package Duke.Exception;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Names representing packages should be in all lower case. Look at Java coding standards for more details.

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.

6 participants