[Cheah Hao Yi] iP#57
Conversation
dhanish265
left a comment
There was a problem hiding this comment.
Overall, I think it's quite good. Just need those minor edits that I suggested.
| public class Duke { | ||
| public static void main(String[] args) { | ||
|
|
||
| public static Task[] tasks = new Task[100]; |
There was a problem hiding this comment.
Please replace magic literal ('100'). Consider using a final value.
| public static Task[] tasks = new Task[100]; | ||
| public static int numTasks = 0; | ||
|
|
||
| public static void listTasks(){ |
There was a problem hiding this comment.
I think there should be a space between the closing bracket and open brace. You can use the reformat code option for the IDE to do it for you
| System.out.println("What can I do for you?"); | ||
| } | ||
|
|
||
| public static boolean toExit(String userInput) { |
There was a problem hiding this comment.
can consider changing the method name to reflect the boolean nature of the method (toExit does not sound like it's a boolean method)
| System.out.println("Beep boop, now you have " + numTasks + " tasks"); | ||
| } | ||
|
|
||
| public static void addDeadline(String param){ |
There was a problem hiding this comment.
perhaps it is accidental, but there are actually 2 spaces between 'public' and 'static' in this method and the next method
kaseykwok
left a comment
There was a problem hiding this comment.
Nice work. Hope my review could help.
| public class Duke { | ||
| public static void main(String[] args) { | ||
|
|
||
| public static Task[] tasks = new Task[100]; |
There was a problem hiding this comment.
Avoid using magic literals. Consider adding a constant for it.
| final String ERROR_OUT_OF_BOUND = "Sorry, the task does not seem to exist :<"; | ||
| tasks[whichTask].setStatus(done); | ||
|
|
||
| if(whichTask > numTasks){ |
There was a problem hiding this comment.
Consider adding spaces before the opening parenthesis and after the closing parenthesis.
| System.out.println("Beep boop, now you have " + numTasks + " tasks"); | ||
| } | ||
|
|
||
| public static void addDeadline(String param){ |
| */ | ||
|
|
||
| final String LOGO = "\n" + | ||
| " _________________________________________\n" + |
There was a problem hiding this comment.
Indentation for wrapped lines should be 8 spaces.
|
|
||
| public static void listTasks(){ | ||
| System.out.println("Beep beep, listing out the tasks....Loading....."); | ||
| for(int i = 0; i < numTasks; i++){ |
There was a problem hiding this comment.
Consider adding space before the opening parenthesis.
morbenami1
left a comment
There was a problem hiding this comment.
Over all great job, amazing code and very creative :)
| public class Duke { | ||
| public static void main(String[] args) { | ||
|
|
||
| public static Task[] tasks = new Task[100]; |
| } | ||
|
|
||
| public static void processUserInput(String userInput){ | ||
| String[] splitInput = userInput.split(" ", 2); |
There was a problem hiding this comment.
instead of splitInput- inputSplitedBySpace
| private boolean isDone; | ||
| private String taskDescription; | ||
|
|
||
| private final String STATUS_DONE_ICON = "X"; |
There was a problem hiding this comment.
gread job! adding the final String for the mark status
| public static void main(String[] args) { | ||
|
|
||
| public static Task[] tasks = new Task[100]; | ||
| public static int numTasks = 0; |
…ity to handle errors" This reverts commit 1f2180e.
sevenseasofbri
left a comment
There was a problem hiding this comment.
Hi Hao Yi, good job on the iP so far! I have added some comments on the code quality, coding standard violations and naming conventions. Hope they will be helpful. 👍🏽
|
|
||
| public static void greetUser() { | ||
|
|
||
| final String LOGO = "\n" |
There was a problem hiding this comment.
Consider moving the final variable to make it a global variable in this class.
| System.out.println(LOGO); | ||
| System.out.println("Hello! I'm Duke"); | ||
| System.out.println("What can I do for you?"); |
There was a problem hiding this comment.
Perhaps can avoid the usage of magic literals by declaring these as final variables in this class. (Same for line 64)
| System.out.println("What can I do for you?"); | ||
| } | ||
|
|
||
| public static boolean isToExit(String userInput) { |
There was a problem hiding this comment.
Perhaps name this function isExit since it would be easier to understand at first glance.
| case ("list"): //Fallthrough | ||
| case ("mark"): //Fallthrough | ||
| case ("unmark"): //Fallthrough | ||
| case ("todo"): //Fallthrough | ||
| case ("deadline"): //Fallthrough |
There was a problem hiding this comment.
Perhaps remove the comment //Fallthrough since it is redundant. You can consider adding one fallthrough comment at the end of the case. (I see this in a couple of places, so do look into that)
| return false; | ||
| } | ||
| } | ||
| private boolean isCorrectInput(String[] parsed ) { |
There was a problem hiding this comment.
Consider adding at least a single line space between functions to improve readability
| } | ||
|
|
||
| private String[] parseParameter(String inputString, String optionFlag){ | ||
| int OPTION_LEN = 4; |
There was a problem hiding this comment.
Naming conventions of regular variables is pascalCase. Consider using that here instead of all caps.
|
|
||
| public void parseUserInput(String userInput) throws UnknownCommandException, DukeException { | ||
|
|
||
| String[] inputSplitBySpace = userInput.split(" ", 2); |
There was a problem hiding this comment.
Do consider avoiding the usage of magic literals. Store and use the values as final variables instead
| public void parseUserInput(String userInput) throws UnknownCommandException, DukeException { | ||
|
|
||
| String[] inputSplitBySpace = userInput.split(" ", 2); | ||
| //assume first word input by user is the command |
There was a problem hiding this comment.
Bring this comment closer to right above the line it describes, so it is clear as to what you are talking about
| public class TaskManager { | ||
|
|
||
| private static final int RESIZE_FACTOR = 2; | ||
| private static int NUM_TASK; |
There was a problem hiding this comment.
Please follow the naming conventions for regular variables. It should be pascalCase for this one since it is not a final variable
# Conflicts: # src/main/java/Duke/InputParser.java
Create Jar file # Conflicts: # src/main/java/Duke/TaskManager.java
Add new exceptions Refactor Exception using Inheritance
Init class for Level 8
Refactor some functions from Duke class into utilities classes
Refactor functionalities more clearly into the utility classes
Add exception check for wrong option flag Add find functionality
Level 9, Week 7 iP task: Find
To push A-MoreOOP tag onto github (missed out earlier)
To create branch for A-JavaDoc (missed out earlier)
Fix minor coding style violations
Fix parser bug for bad option flags Refactor to replace hardcoded line seperator with java system line separator
Added week 3 iP progress