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

[Sherwin Poh Kai Xun] iP #470

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

Conversation

sherrpass
Copy link

@sherrpass sherrpass commented Aug 26, 2021

DukeMaster

“You miss 100% of the shots you don’t take.” - Kobe Bryant

DukePro frees your mind of having to remember things you need to do. It's,

  • Amazing
  • Fast
  • Convenient

All you need to do is to is,

  1. Download it right here
  2. double-click it.
  3. add your tasks.
  4. let it manage your tasks for you 😉

And it is FREE!

Features:

  • Managing tasks
  • Managing deadlines (coming soon)
  • Reminders (coming soon)
  • Be actually useful (coming I hope)

Here's the main method that sparks the program off!

public static void main(String[] args) {
    new Duke("./data", "./data/tasks.txt").run();
}

Copy link

@kevinchua6 kevinchua6 left a comment

Choose a reason for hiding this comment

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

Good job overall!

* @param data_folder_path Path to the data folder.
* @param data_file_path Path to the data file.
*/
public Storage(String data_folder_path, String data_file_path) {

Choose a reason for hiding this comment

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

Should variables be in camelCase?

import static org.junit.jupiter.api.Assertions.fail;

public class StorageTest {
private final static String TEST_DATA_FOLDER_PATH = "./dataTest";
Copy link

@kevinchua6 kevinchua6 Sep 1, 2021

Choose a reason for hiding this comment

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

I think you shouldn't use private final static, but private static final: https://google.github.io/styleguide/javaguide.html

return (isDone ? "X" : " "); // mark done task with X
}

public boolean getDoneStatus() {

Choose a reason for hiding this comment

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

Shouldn't boolean methods sound like booleans? Any reason why you didn't do something like isDone or hasCompleted?

return "|" + getStatusIcon() + "|" + description;
}

public boolean matches(String query) {
Copy link

@kevinchua6 kevinchua6 Sep 1, 2021

Choose a reason for hiding this comment

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

Again, shouldn't boolean methods should sound like booleans? Perhaps a more intuitive or explanatory method name here?

@@ -0,0 +1,7 @@
package duke;

import static org.junit.jupiter.api.Assertions.*;

Choose a reason for hiding this comment

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

Should we use individual imports instead of wildcard imports?

ArrayList<Task> matchingTasks = tasks.getMatchingTasks(query);
showTasks(matchingTasks);
}
}

Choose a reason for hiding this comment

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

I like that you have a consistent naming system for methods!

matchingTasks.removeIf(task -> !task.matches(query));
return matchingTasks;
}
}

Choose a reason for hiding this comment

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

I like that you use verbs for all your method names!

Copy link

@wlren wlren left a comment

Choose a reason for hiding this comment

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

LGTM! Looks very clean and has good quality code overall, besides the comments that the previous reviewer gave, I identified a few small details to take note of, good job!

Comment on lines 43 to 53
case "todo":
newTask = new Todo(description);
break;
case "deadline":
newTask = new Deadline(description, date);
break;
case "event":
newTask = new Event(description, date);
break;
default:
throw new DukeException("Invalid task type provided!");
Copy link

Choose a reason for hiding this comment

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

Coding standard for CS2103 requires switch statements to not have tab for case, take note to edit the default IDE settings!

* Represents a deadline task.
*/
public class Deadline extends Task {
protected LocalDate by;
Copy link

Choose a reason for hiding this comment

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

Should perhaps be private since there is already a getter method that exposes this variable

Comment on lines +52 to +57
@Override
public boolean matches(String query) {
return super.matches(query)
|| by.format(DateTimeFormatter.ofPattern("MMM dd yyyy")).toLowerCase().contains(query.toLowerCase())
|| query.equalsIgnoreCase("deadline");
}
Copy link

Choose a reason for hiding this comment

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

A comment to explain this logic would be great

* @param ui UI component.
*/
@Override
public void execute(TaskList tasks, Storage storage, Ui ui) {
Copy link

Choose a reason for hiding this comment

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

Suggested change
public void execute(TaskList tasks, Storage storage, Ui ui) {
public void execute(TaskList tasks, Storage storage, Ui ui) throws DukeException {

Comment on lines 7 to 9
private Storage storage;
private TaskList tasks;
private Ui ui;
Copy link

Choose a reason for hiding this comment

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

Can be private final

throw new DukeException("I'm sorry, but I don't know what that means :-(");
}
} catch (DateTimeParseException e) {
throw new DukeException("Date provided should be in YYYY-MM-DD format.");
Copy link

Choose a reason for hiding this comment

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

Is there perhaps a better way to do the error handling?

sherrpass and others added 17 commits September 9, 2021 23:53
Current Duke codebase has many implicit assumptions
about the Internal Invariants and Control-Flow Invariants.

Unverified assumptions may cause bugs to be undiscovered
during development and cause issues for the user
in production.

Let's add assertions throughout the codebase to verify
these assumptions.

Thorough checking of assumptions using assertions can
ensure that bugs in the code are discovered quickly.
Current code has areas of improvement with regards
to readability and code duplication.

Poor readability would make the code less
maintainable and comprehensable to others. Code
duplication may lead to greater effort to
adjust duplicated code in future.

Implemenented SLAP, abstracted more logic to make
code at each level simpler, removed duplicated
code.

SLAP, abstractions and DRY principle makes code
more readable and improves code quality.
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.

3 participants