-
Notifications
You must be signed in to change notification settings - Fork 117
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
[paulktham] iP #104
base: master
Are you sure you want to change the base?
[paulktham] iP #104
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do refer to the coding style guide and notes on readability to improve the overall readability of code.
src/main/java/Tyrone.java
Outdated
System.out.println(" see you brother"); | ||
System.out.println(Constants.LINE); | ||
} | ||
public static void getUserInput(String userInput){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Methods should be kept within 30 LoCs. You can extract parts of your code as different methods.
src/main/java/Tyrone.java
Outdated
import java.util.Scanner; | ||
|
||
public class Tyrone { | ||
public class Constants{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Constants class should be defined in a new file for better readability
src/main/java/Tyrone.java
Outdated
} | ||
} | ||
} | ||
public static void main(String[] args) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line spacing can be used to separate code into more "logical" chunks (e.g. add spacing between different methods)
src/main/java/Tyrone.java
Outdated
switch (userInput){ | ||
case "list": | ||
System.out.println(Constants.LINE); | ||
for (int i=1; i<listCount+1;i++){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent spacing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall good job. Just a few suggestions for you to consider.
src/main/java/Tyrone.java
Outdated
import tyrone.task.ToDo; | ||
|
||
public class Tyrone { | ||
public static void getUserInput(String userInput) throws TyroneException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method is very long, you may consider extracting each case into separate methods. It will be better to keep methods short.
} | ||
Constants.goodbye(); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please leave a new line at the end of each page.
Task task = toDoList.get(i); | ||
String statusIcon = task.getStatusIcon(); | ||
if (task instanceof Deadline) { | ||
System.out.println(" " + (i + 1) + ". [D][" + statusIcon + "] " + task.getDescription() + " (by: " + ((Deadline) task).getDoBy() + ")"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may consider wrapping the line if it gets too long.
toDoList.get(index).setDone(true); | ||
System.out.println(LINE); | ||
System.out.println(" TIGHT! I've marked this task as done:"); | ||
System.out.println(" [X] " + toDoList.get(index).getDescription()); | ||
System.out.println(LINE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can consider extracting this part into a method and pass in parameters to differentiate with unmarkAsUndone
as they are pretty similar.
System.out.println(Constants.LINE); | ||
System.out.println(" Got it. I've added this task:"); | ||
System.out.println(" [D][ ] " + deadlineTask.getDescription() + " (by: " + deadlineTask.getDoBy() + ")"); | ||
System.out.println(" Now you have " + Task.listCount + " tasks in the list."); | ||
System.out.println(Constants.LINE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may consider extracting the printing output part into a method as the similar pattern has been used in a few other methods.
System.out.println(" Noted. I've removed this task:"); | ||
String taskType = removedTask instanceof Deadline ? "D" : removedTask instanceof Event ? "E" : "T"; | ||
String statusIcon = removedTask.getStatusIcon(); | ||
System.out.println(" [" + taskType + "][" + statusIcon + "] " + removedTask.getDescription()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may consider extracting the indentation into a named constant as it's used quite often in the code.
DateTime and priority list implemented
find function
JavaDoc Improvements
No description provided.