Skip to content

[Sherwin Poh Kai Xun] iP#470

Open
sherrpass wants to merge 45 commits into
nus-cs2103-AY2122S1:masterfrom
sherrpass:master
Open

[Sherwin Poh Kai Xun] iP#470
sherrpass wants to merge 45 commits into
nus-cs2103-AY2122S1:masterfrom
sherrpass:master

Conversation

@sherrpass

@sherrpass sherrpass commented Aug 26, 2021

Copy link
Copy Markdown

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();
}

@kevinchua6 kevinchua6 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Good job overall!

Comment thread src/main/java/duke/Storage.java Outdated
* @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) {

Copy link
Copy Markdown

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?

Comment thread src/test/java/duke/StorageTest.java Outdated
import static org.junit.jupiter.api.Assertions.fail;

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

@kevinchua6 kevinchua6 Sep 1, 2021

Copy link
Copy Markdown

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

Copy link
Copy Markdown

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) {

@kevinchua6 kevinchua6 Sep 1, 2021

Copy link
Copy Markdown

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?

Comment thread src/test/java/duke/DukeTest.java Outdated
@@ -0,0 +1,7 @@
package duke;

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

Copy link
Copy Markdown

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);
}
}

Copy link
Copy Markdown

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;
}
}

Copy link
Copy Markdown

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!

@wlren wlren left a comment

Copy link
Copy Markdown

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 thread src/main/java/duke/AddCommand.java Outdated
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
Copy Markdown

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
Copy Markdown

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
Copy Markdown

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
Copy Markdown

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 thread src/main/java/duke/Duke.java Outdated
Comment on lines +7 to +9
private Storage storage;
private TaskList tasks;
private Ui ui;

Copy link
Copy Markdown

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
Copy Markdown

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