-
Notifications
You must be signed in to change notification settings - Fork 205
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
[Cher Wei Jie] Duke Increments #113
base: master
Are you sure you want to change the base?
Conversation
Add toolVersion block in to Gradle code sample to prevent errors.
Change file mode on `gradle` to be executable (nus-cs2103-AY1920S2#9)
Gradle defaults to an empty stdin which results in runtime exceptions when attempting to read from `System.in`. Let's add some sensible defaults for students who may still need to work with the standard input stream.
Add configuration for console applications
The OpenJFX plugin expects applications to be modular and bundled with jlink, resulting in fat jars that are not cross-platform. Let's manually include the required dependencies so that shadow can package them properly.
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 on the code! Consider tweaking some portions to follow SOLID principles.
src/main/java/Task.java
Outdated
* input will generate. | ||
*/ | ||
class Task { | ||
private static String horizontalLine = "__________________________________________"; |
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 variable is not used and it should be removed.
System.out.println("\n" + "Alright, I've added this task:" + "\n"); | ||
System.out.println(toDo + "\n"); | ||
System.out.println("You currently have " | ||
+ tasks.getTaskList().size() | ||
+ " task(s) in the list."); |
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 exporting magic strings to another class for neater code.
ui.showLine(); | ||
ui.showDoneMessage(); | ||
doneTask.markAsDone(); | ||
System.out.println(doneTask + "\n"); |
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.
Good job using SLAP.
src/main/java/Parser.java
Outdated
if (command.equals("bye")) { | ||
return new ExitCommand(); | ||
} else if (command.equals("list")) { | ||
return new ListCommand(); | ||
} else if (command.startsWith("done")) { | ||
String[] arrOfCommands = command.split(" "); | ||
int num = Integer.parseInt(arrOfCommands[1]); | ||
return new DoneCommand(num); | ||
} else if (command.startsWith("deadline")) { | ||
return new AddCommand(command); | ||
} else if (command.startsWith("todo")) { | ||
return new AddCommand(command); | ||
} else if (command.startsWith("event")) { | ||
return new AddCommand(command); | ||
} else if (command.startsWith("delete")) { | ||
return new DeleteCommand(command); | ||
} else if (command.startsWith("find")) { | ||
return new FindCommand(command); | ||
} |
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.
Agreed! 👍
String readCommand() { | ||
Scanner scan = new Scanner(System.in); | ||
String command = scan.nextLine(); | ||
return command; | ||
} |
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 creating a single scanner object in the main method instead of creating a new object every time the method is called.
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.
In general, clean code! Good job. Please keep up the good work.
fxmlLoader.setRoot(this); | ||
fxmlLoader.load(); | ||
} catch (IOException e) { | ||
e.printStackTrace(); |
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.
In general, printing stack trace is not considered good exception handling. Think what better you can do here when an exception occurs?
/** | ||
* You should have your own function to generate a response to user input. | ||
* Replace this stub with your completed method. | ||
*/ |
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.
update the header comments
); | ||
userInput.clear(); | ||
|
||
if (response.startsWith("Bye-bye!")) { |
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 improve SLAP here.
Refactored some code and deleted unused methods
Implemented assertions and removed unused methods
Implemented mass delete function
No description provided.