-
Notifications
You must be signed in to change notification settings - Fork 437
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
[Teo Zay We, Simon] iP #397
base: master
Are you sure you want to change the base?
Conversation
Add DateTime functionality for Events and Deadlines
Level-7: Save
Add functionality to search list based on keyWord
Add JavaDoc comments to all non-public classes and methods
Add Gradle support
Set up Checkstyle and fix styling errors
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 & clean code!
src/main/java/duke/Storage.java
Outdated
* @param items List of tasks. | ||
* @return A string that can be stored in the .txt file. | ||
*/ | ||
String allTasksCombined(ArrayList<Task> items) { |
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.
Perhaps can consider using a verb for the method name? (E.g. CombineAllTasks etc)
src/main/java/duke/TaskList.java
Outdated
/** | ||
* Exit function for TaskList class, writes data to .txt file. | ||
*/ | ||
public void 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.
Bye might be a little confusing haha. Consider including the fact that it writes data.
13091fe
to
1a9bdc1
Compare
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.
The quality of your code is good, and you followed the coding standards strictly. Feel free to reply if you have any questions.
* @return A task to be added by the TaskList. | ||
* @throws InvalidDescriptionException In case the task description is empty. | ||
* @throws InvalidTypeException In case the task type is not one of Event, Deadline, Todo. | ||
*/ |
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.
The javadocs are clear and easy to understand
/** | ||
* Exit function for TaskList class, writes data to .txt file. | ||
*/ | ||
public void saveData() throws IOException { |
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.
The naming of the functions and fields are in the correct form.
@@ -0,0 +1,26 @@ | |||
package duke.task; | |||
|
|||
/** |
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.
The structure of your class is very clean and easy to read.
delete -1 | ||
delete 2 | ||
list | ||
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 may add more test cases to test your code.
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.
LGTM! Overall, really well-organised code, especially at how you handled your exceptions and the Parser. Maybe as a challenge to yourself you can consider implementing the Command Pattern and making use of regex!
package duke.exception; | ||
|
||
/** | ||
* Invalid Data Exception that extends Duke Exception class. |
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.
Perhaps can be more specific to what data/situations this exception would appear?
/** | ||
* Invalid Index Exception that extends Duke Exception class. | ||
*/ | ||
public class InvalidIndexException extends DukeException { |
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.
I really like how you are so specific with your exceptions, and how you've organised them all into an Exceptions package! Definitely learning from this!
src/main/java/duke/misc/Parser.java
Outdated
String[] dl = input.split(" /by "); | ||
if (dl[0].substring(8).equals("") || dl[0].substring(9).equals("")) { |
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.
Perhaps could explore regex as an extension so that your input can be slightly more flexible?
src/main/java/duke/misc/Storage.java
Outdated
static final String HOME = System.getProperty("user.home"); | ||
static final Path DIR = Paths.get(HOME, "data"); | ||
static final Path PATH = Paths.get(HOME, "data", "iPStore.txt"); | ||
static final String IO_MESSAGE = "Sorry! There was an IOException! Initialising with an empty Tasklist!"; | ||
static final String INVALID_MESSAGE = "Sorry! There was an error in reading your data! " | ||
+ | ||
"Initialising with a semi-complete Tasklist!"; |
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.
I like how your constants are cleanly organised at the top!
/** | ||
* TaskList class to store all the tasks in Duke. | ||
*/ | ||
public class TaskList { |
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 you can consider the Command pattern to handle the user commands, so some of the string output responsibilities can be abstracted out?
/** | ||
* DateTime class used to store date objects. | ||
*/ | ||
public class DateTime { |
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.
I really like how you abstracted out all logic regarding dateTime formatting to this Class! It even handles valid formatting!
src/main/java/duke/task/Task.java
Outdated
* | ||
* @return String describing the task. | ||
*/ | ||
public String saveString() { |
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.
Perhaps a more apt method name would be getSaveString()?
try { | ||
Parser.handleInput("example hello"); | ||
} catch (InvalidTypeException e) { | ||
assertEquals("OOPS!!! I'm sorry, but I don't know what that means :-(", | ||
e.getMessage()); | ||
} catch (InvalidDescriptionException e) { | ||
assertEquals("OOPS!!! The description of a task cannot be empty", | ||
e.getMessage()); |
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.
I really like how you're also testing your exceptions! But perhaps you could also include some test cases for normal expected inputs?
Use Regex to enhance readability
Improve Coding Quality
Branch a assertions
Allow tagging when user starts word with #
Branch a better gui
39db5ba
to
61c8b84
Compare
No description provided.