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

[Ming Yang] iP #216

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

Conversation

yongmingyang
Copy link

No description provided.

Copy link

@wltan wltan left a comment

Choose a reason for hiding this comment

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

There are a few recurring issues but everything else is mostly ok.

There are a bunch of class files being committed. Your output folder should probably be added to .gitignore.

private boolean end;

/**
* Initializes a Command object
Copy link

Choose a reason for hiding this comment

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

Consider ending the summary sentence with a period?
Javadoc requires that the first sentence ends with a period. https://www.oracle.com/technical-resources/articles/java/javadoc-tool.html

image

* @param task String representing task to be appended
*/

public void appendFile (String task) {
Copy link

Choose a reason for hiding this comment

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

Consider removing the whitespace between the method name and parameters?
image

Copy link

Choose a reason for hiding this comment

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

Same on line 66.

int size = todo.size() - 1;
Ui.showLine();
System.out.println("Noted. I've removed this task: \n"
+ todo.get(taskNumber - 1) + "\n" + "Now you have " + size + " task in the list \n"
Copy link

Choose a reason for hiding this comment

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

This is slightly over 110 characters. Since it's already being wrapped from Line 54 maybe you could wrap it again to another line?

* Adds an event task to the task list.
*
* @param line the line in which the command of adding event was given.
* @throws DukeInvalidTaskException
Copy link

Choose a reason for hiding this comment

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

Consider specifying under what conditions the exception is thrown?

Deadline task = new Deadline("hi", "2020-01-01");
String expected = "[D][✗] hi (by: Jan 1 2020)";
assertEquals(expected, task.toString());
} catch (DukeInvalidTaskException | DukeInvalidDateException e) {
Copy link

Choose a reason for hiding this comment

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

If an exception is caught and you weren't expecting it, will this cause the test to pass mistakenly? You might want to check that out.

Copy link

@joshualiangxy joshualiangxy left a comment

Choose a reason for hiding this comment

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

While there are quite a few styling issues, I like the logic of your program! Keep up the good work!

* @param action The type of action take as given by the task.
*/
public Command(String task, String action) {
this.end = false;

Choose a reason for hiding this comment

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

Maybe leave out the this keyword when it's not needed to make the code more succinct?

* @param ui the user interface object.
*/

public void execute(TaskList taskList, Ui ui) throws DukeException {

Choose a reason for hiding this comment

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

This method is quite long. Perhaps you could abstract away parts to make it more readable?

public class Storage {
private final File dataFile;
@SuppressWarnings({"checkstyle:AbbreviationAsWordInName", "CheckStyle"})
private final String FILE_PATH;

Choose a reason for hiding this comment

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

Perhaps use camel casing here, since file path is not a constant, but varies between instances of the Storage class?

FileWriter fw = new FileWriter(FILE_PATH);
for (Task currentTask : list) {
String done = currentTask.isDone() ? "1" : "0";
if (currentTask instanceof Event) {

Choose a reason for hiding this comment

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

Perhaps you could make use of polymorphism here, since all 3 task types extends the Task class. This can help make the code a lot more succinct and readable.

*
* @param list in which the tasks are stored
*/
public void welcomeMessage(TaskList list) {

Choose a reason for hiding this comment

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

Maybe naming the method with a verb can help the program be more understandable?


public Deadline(String taskName, String date) throws DukeInvalidDateException, DukeInvalidTaskException {
super(taskName);
if (!date.equals(null) && !date.equals(" ")) {

Choose a reason for hiding this comment

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

Maybe using guard clauses here can ensure that your main program logic is more prominent?

image

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

3 participants