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

[Tan Ying Hui] iP #253

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

Conversation

ureshiiYing
Copy link

No description provided.

damithc and others added 28 commits July 23, 2020 23:27
Used exceptions and if, else and print statements to signal and display error
Reformatted some of the if-else code to switch cases
Figured out a better way to split the input
Handled errors such as insufficient arguments in command, unknown commands, empty description for tasks
Did regression testing and passed
Added new test cases for error handling
Removed any white spaces in front/ behind the input
Also passed the same test cases as before
Added the delete feature and handled the same type of errors handled previously
Did regression testing and passed
Added new delete test cases
Added a SaveLoad class that is responsible for loading and saving a local save file for PandaBot
Handled error for any loading error in the SaveLoad class
Created a DateAndTime class which allows PandaBot to understand date and time in the format dd/mm/yyyy hhmm
Edited the Deadline behaviour such that Deadlines can accept both formatted and unformatted input as due by dates
Added FindCommand feature
# Conflicts:
#	src/main/java/DeleteCommand.java
#	src/main/java/Event.java
#	src/main/java/PandaBot.java
#	src/main/java/PandaBotException.java
#	src/main/java/PandaBotInvalidArgumentFormatException.java
#	src/main/java/PandaBotInvalidCommandException.java
#	src/main/java/PandaBotLoadingTasksErrorException.java
Missed out checking the validity of the date input, which has been added
Copy link

@UnicornJin UnicornJin left a comment

Choose a reason for hiding this comment

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

Nice code, Jia You

this.task = task;
}

/**

Choose a reason for hiding this comment

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

Good JavaDoc

/**
* Represents a bye command which allows users to exit the program.
*/
public class ByeCommand extends Command {

Choose a reason for hiding this comment

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

It seems you are using different classes for UI output, it's okay.
You can also do this in one single class lah

Copy link
Author

Choose a reason for hiding this comment

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

I thought it would be better if the Ui class was in charge of all the messages to be printed (Single Responsibility Principle?)

* Represents a Command, which is an abstract class.
* The Command class is used to execute a command.
*/
public abstract class Command {

Choose a reason for hiding this comment

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

Oh you use abstract class, that's good.

* @throws PandaBotException If any errors occurs when executing the command
*/
@Override
public void execute(TaskList tasks, Ui ui, Storage storage) throws PandaBotException {

Choose a reason for hiding this comment

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

Maybe name this function as executeOrder/executeCommand would be better

Copy link

@JinHao-L JinHao-L left a comment

Choose a reason for hiding this comment

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

Your code is easy to follow and understand. I like how you separated the commands into the different command type as this allows for easy addition of more command type in the future and also customisation of each command execution. The structure of your program was good and really complies with OOP.

One suggestion that I would like to make is to use packaging as it helps structure and organises your project files, especially when your project files grow with each iteration.

Overall, the project is quite well done and a pleasure to read. All the best!! 👍

private String dueBy;

/**
* Create a Deadline object.
Copy link

Choose a reason for hiding this comment

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

Should it be "Creates a Deadline object" instead?

Copy link
Author

Choose a reason for hiding this comment

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

Yes, thanks for pointing that out.

Comment on lines 19 to 24
/**
* Returns true if the program should exit.
* Otherwise, returns false if the program should continue to run.
*
* @return true as the program exits on bye command
*/
Copy link

Choose a reason for hiding this comment

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

I think that the {@inheritdoc} might be helpful here if the JavaDoc of the overridden method is the same.

/**
* Represents a type of PandaBotException which is thrown when the task description is empty.
*/
public class PandaBotEmptyTaskDescriptionException extends PandaBotException{
Copy link

Choose a reason for hiding this comment

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

Should there be whitespace before the curly braces?

Copy link
Author

Choose a reason for hiding this comment

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

Yes, thanks for pointing that out.

}

private Task convertToTask(String input) throws PandaBotException{
String[] tDes = input.split(" \\| ");
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 intuitive variable name here? For example, taskDetails

Comment on lines 70 to 84
int len = tasks.size();
if (len == 0) {
System.out.println("WOOTS! You don't have any tasks to do at the moment.");
} else {
System.out.println("These are the task(s) you have: ");
int i = 0;
for (Task t : tasks.getTaskList()) {
if (t != null) {
System.out.println((i + 1) + ". " + t.toString());
i++;
} else {
break;
}
}
}
Copy link

Choose a reason for hiding this comment

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

Just a thought of mine but perhaps these implementations could be handled by their respective command and Ui could purely be in charge of printing out the String outputs given by the execution of the commands

Copy link
Author

Choose a reason for hiding this comment

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

I realised your suggestion came in handy, for the GUI implementation. Thanks!

ureshiiYing and others added 30 commits September 7, 2020 22:06
Currently, no assertions are used.
Assertions can be used to verify any assumptions made while coding.
This differs from using exceptions to check external inputs.

Use assertions to the code verify that any assumptions made holds true.
Some parts of the code do not follow the recommended code quality guidelines.

Code should be of high quality in order to maximise readibility.

Improve code quality by following the recommended guidelines.
Some of the method and variable names are not well-named.
This could lead to potential confusion.
Use proper names and use names to explain the code to improve code quality.
# Conflicts:
#	src/main/java/pandabot/parser/Parser.java
#	src/main/java/pandabot/storage/Storage.java
This gives PandaBot more features.

An additional change is: Extracting a parent class, TimedTask.

Tasks such as Event, Deadline, and the newly added DoAfter have a common attribute - time.
Processing the various tasks with time separately causes code duplication.

Let's extract the time attribute into a new parent class named TimedTask, which can be used to
represent tasks with time attribute. It can accept both unformatted and formatted time input.
PandaBot does not have any means to allow users to be sure that they are giving the correct input format.

This could confuse users who are not familiar with PandaBot's features.

Add a help command which will bring up a help page that contains a list of commands that the
user can use.

Let's make this help page to help familiarise users with PandaBot's available commands.
The PandaBot GUI is very basic.

It can be improved by personalising the GUI.

Let's
* Make the GUI window responsive to resizing of window
* Add a background to PandaBot using CSS
* Stylize the dialog box using CSS
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

4 participants