-
Notifications
You must be signed in to change notification settings - Fork 77
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
[John Toh] iP #62
base: master
Are you sure you want to change the base?
[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
src/main/java/Event.java
Outdated
|
||
@Override | ||
public String toString() { | ||
return "[E]" + super.getStatusIcon()+ " " + super.getDescription() + " (at: " + at + ")"; |
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.
consider adding space after getStatusIcon().
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.
Well written code with good breakdowns. Just some minor issues and issue of SLAP.
src/main/java/TaskHandler.java
Outdated
} | ||
|
||
public static void handleTodo(String input) { | ||
String[] splitInput = input.split(" ", 2); |
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.
Consider naming 2 as a constant, difficult to tell what the number 2 means
src/main/java/InputHandler.java
Outdated
private static final String MARK = "mark"; | ||
private static final String UNMARK = "unmark"; | ||
|
||
public static void handleInput() { |
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.
Consider adding comments for all ur functions so it is more readable, as described in the code quality page on the module website
src/main/java/TaskList.java
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
src/main/java/TaskHandler.java
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
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.
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.
src/main/java/Duke.java
Outdated
UI.welcomeUser(); | ||
FileManager.startReading(); | ||
InputHandler.handleInput(); |
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 should set the indentation to 4 spaces to ensure consistency and in adherance to the coding standard.
src/main/java/file/FileManager.java
Outdated
|
||
public class FileManager { | ||
|
||
private static Path taskDataPath = Paths.get(System.getProperty("user.dir"), "data", "tasks.txt"); |
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.
Maybe consider replacing the tasks.txt
portion with a constant, to eliminate magic literals.
src/main/java/file/FileManager.java
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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"; |
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.
Great usage of final variables!
private static final String DELETE = "delete"; | ||
|
||
public static void handleInput() { | ||
boolean exit = false; |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could instead set the delimiter as a constant to eliminate magic literals.
src/main/java/task/TaskList.java
Outdated
System.out.println(LINE_DIVIDER); | ||
} | ||
|
||
private static void printMark(int target, boolean mark) { |
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.
Consider renaming the mark
variable to isMarked
, to keep consistency in naming convention.
Repackaged some files
Add JavaDoc
No description provided.