[FeathersRe] iP#189
Conversation
|
|
||
| Scanner in = new Scanner(System.in); | ||
| String command = in.nextLine(); | ||
|
|
There was a problem hiding this comment.
Perhaps its a good idea to use SLAP here! Since your Main is more than 30 LoC, readability maybe affected.
| isDone = false; | ||
| } | ||
|
|
||
| public String toString() { |
There was a problem hiding this comment.
Perhaps this expression can be stored in a variable? This will help you avoid complicated expressions
| import java.util.Scanner; | ||
|
|
||
| public class Daisy { | ||
| public static void main(String[] args) { |
There was a problem hiding this comment.
I like you named these literals. This improves the readability of your code as you're removing redundant lines
| final String INTRO_PROMPT = "Good day! This is Daisy.\nAny task for today?"; | ||
| final String EXIT_PROMPT = "Ending prompt received. Remember to keep to the deadlines!"; | ||
| final String LINE_BREAK = "____________________________________"; | ||
| Task[] tasks = new Task[100]; |
There was a problem hiding this comment.
Perhap this magic number can be avoided? Using a named constant (Like you did for your literal above) will allow others to understand the meaning of this number.
* Level-5: Level-5 Commits
* A-Packages: Packaging commit
* branch-Level-6: Level-6 Commits
* branch-Level-7: Level-7 Commits # Conflicts: # src/main/java/Daisy.java
wwweert123
left a comment
There was a problem hiding this comment.
Well organized code which follows coding standards and code quality practices, can consider adding more OOP
|
|
||
| loadData(); | ||
|
|
||
| System.out.println(LINE_BREAK); |
There was a problem hiding this comment.
Can consider more SLAP here, eg printIntro()
| Scanner in = new Scanner(System.in); | ||
| String command = in.nextLine(); | ||
|
|
||
| while (!command.equals("bye")) { |
There was a problem hiding this comment.
Can consider abstracting this to parser class in the future
| String[] separate_commands = command.split(" ",2); | ||
| switch (separate_commands[0]) { | ||
| case "list": | ||
| for (Task task : tasks) { |
There was a problem hiding this comment.
Can consider more SLAP, printAllTasks()
| System.out.println("Congrats on completing the task!"); | ||
| System.out.println(tasks.get(Integer.parseInt(separate_commands[1])-1)); | ||
| break; | ||
| case "unmark": |
There was a problem hiding this comment.
Can define all constants at the top for all command strings to prevent using magic literals
| } | ||
| } | ||
|
|
||
| public static void createTodo(String taskName, boolean printOut, boolean setDone) { |
There was a problem hiding this comment.
Can consider creating a command abstract task and subclasses such as AddCommand for creating tasks
| addItem(newEvent, printOut); | ||
| } | ||
|
|
||
| public static void loadData() { |
There was a problem hiding this comment.
Can consider having a storage class for loading and storing to file
| @@ -0,0 +1,4 @@ | |||
| package daisy.error; | |||
|
|
|||
| public class IllegalDeadlineFormatException extends Exception{ | |||
There was a problem hiding this comment.
Can create specific methods in the exception that print specific error messages, exceptions act just like classes
Level-8 Commits
Branch level 9
Revert "Branch level 9"
Revert "Revert "Branch level 9""
# Conflicts: # src/main/java/daisy/parser/Parser.java # src/main/java/daisy/task/Deadline.java # src/main/java/daisy/task/Event.java
Branch a java doc
No description provided.