Skip to content
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

Open
wants to merge 46 commits into
base: master
Choose a base branch
from

Conversation

simonteozw
Copy link

No description provided.

@simonteozw simonteozw changed the title [Teo Zay We, Simon] IP [Teo Zay We, Simon] iP Aug 25, 2020
Copy link

@TheSpaceCuber TheSpaceCuber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great & clean code!

* @param items List of tasks.
* @return A string that can be stored in the .txt file.
*/
String allTasksCombined(ArrayList<Task> items) {

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)

/**
* Exit function for TaskList class, writes data to .txt file.
*/
public void bye() {

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.

Copy link

@Ringo1225 Ringo1225 left a 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.
*/

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 {

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;

/**

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

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.

Copy link

@maxxyh maxxyh left a 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.
Copy link

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 {
Copy link

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!

Comment on lines 35 to 36
String[] dl = input.split(" /by ");
if (dl[0].substring(8).equals("") || dl[0].substring(9).equals("")) {
Copy link

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?

Comment on lines 24 to 30
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!";
Copy link

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 {
Copy link

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 {
Copy link

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!

*
* @return String describing the task.
*/
public String saveString() {
Copy link

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()?

Comment on lines 13 to 20
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());
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants