[John Toh] iP#62
Conversation
Improved code formatting
Duke can now add tasks and mark/unmark them
Edited some code to align it with the given stardards
Coding quality may need further improvement.
Has issues running the tests
Testing still has issues
|
|
||
| @Override | ||
| public String toString() { | ||
| return "[E]" + super.getStatusIcon()+ " " + super.getDescription() + " (at: " + at + ")"; |
There was a problem hiding this comment.
consider adding space after getStatusIcon().
Franky4566
left a comment
There was a problem hiding this comment.
Well written code with good breakdowns. Just some minor issues and issue of SLAP.
| } | ||
|
|
||
| public static void handleTodo(String input) { | ||
| String[] splitInput = input.split(" ", 2); |
There was a problem hiding this comment.
Consider naming 2 as a constant, difficult to tell what the number 2 means
| private static final String MARK = "mark"; | ||
| private static final String UNMARK = "unmark"; | ||
|
|
||
| public static void handleInput() { |
There was a problem hiding this comment.
Consider adding comments for all ur functions so it is more readable, as described in the code quality page on the module website
| System.out.println("Marked this task: \n " + tasks[target - 1]); | ||
| } else { | ||
| System.out.println("Unmarked this task: \n" + tasks[target - 1]); | ||
| } | ||
| System.out.println(LINE_DIVIDER); |
There was a problem hiding this comment.
Phrases "Marked this task: \n" and "Unmarked this task: \n" can be written as a constant String when outputting
like line 21 declared in line 5
| String[] splitInput = input.split(" ", 2); | ||
| String[] splitCommand = splitInput[1].split(" /by ", 2); // 0 is description, 1 is by | ||
| Deadline deadline = new Deadline(splitCommand[0], splitCommand[1]); | ||
| TaskList.addDeadLine(deadline); |
There was a problem hiding this comment.
lines 32 and 33 can be abstracted into another function as the splitting is quite complicated (SLAP issue). Once extracted can be declared like line 35
Nothing of value is added
Can merge as level 6
Merge with level 7 branch in future
This reverts commit 3ea3669.
exetr
left a comment
There was a problem hiding this comment.
Great job on your code so far! Good to see a effective use of packaging within your application. The few comments I have left aims to improve the consistency in certain aspects of your code base.
| UI.welcomeUser(); | ||
| FileManager.startReading(); | ||
| InputHandler.handleInput(); |
There was a problem hiding this comment.
You should set the indentation to 4 spaces to ensure consistency and in adherance to the coding standard.
|
|
||
| public class FileManager { | ||
|
|
||
| private static Path taskDataPath = Paths.get(System.getProperty("user.dir"), "data", "tasks.txt"); |
There was a problem hiding this comment.
Maybe consider replacing the tasks.txt portion with a constant, to eliminate magic literals.
| File f = new File(filePath); | ||
| Scanner s = new Scanner(f); | ||
| while (s.hasNext()) { | ||
| String[] input = s.nextLine().split(" | "); |
There was a problem hiding this comment.
Similarly, consider setting the delimiter you use as a constant, in order to eliminate magic literals.
| private static final String TODO = "todo"; | ||
| private static final String LIST = "list"; | ||
| private static final String DEADLINE = "deadline"; | ||
| private static final String EVENT = "event"; | ||
| private static final String BYE = "bye"; | ||
| private static final String MARK = "mark"; | ||
| private static final String UNMARK = "unmark"; | ||
| private static final String DELETE = "delete"; |
| private static final String DELETE = "delete"; | ||
|
|
||
| public static void handleInput() { | ||
| boolean exit = false; |
There was a problem hiding this comment.
Consider renaming the boolean to isExit, in adherence to the naming convention.
| private static String getCommand(String input) { | ||
| return input.split(" ", 2)[0].trim(); | ||
| } | ||
|
|
||
| private static String getAction(String input) throws ArrayIndexOutOfBoundsException { | ||
| return input.split(" ", 2)[1].trim(); | ||
| } |
There was a problem hiding this comment.
You could instead set the delimiter as a constant to eliminate magic literals.
| System.out.println(LINE_DIVIDER); | ||
| } | ||
|
|
||
| private static void printMark(int target, boolean mark) { |
There was a problem hiding this comment.
Consider renaming the mark variable to isMarked, to keep consistency in naming convention.
Repackaged some files
Add JavaDoc
No description provided.