Skip to content

[Gernene Tan] iP#290

Open
Gernene wants to merge 52 commits into
nus-cs2103-AY2122S2:masterfrom
Gernene:master
Open

[Gernene Tan] iP#290
Gernene wants to merge 52 commits into
nus-cs2103-AY2122S2:masterfrom
Gernene:master

Conversation

@Gernene
Copy link
Copy Markdown

@Gernene Gernene commented Jan 28, 2022

Duke

Create

  • Deadlines

  • Events

  • Todo Items

  • Check off items

  • Mark tasks as not done

  1. Fast
  2. Simple
  3. Easy

I am Duke!

public void start(Stage stage) {
        try {
            FXMLLoader fxmlLoader = new FXMLLoader(Main.class.getResource("/view/MainWindow.fxml"));
            AnchorPane ap = fxmlLoader.load();
            Scene scene = new Scene(ap);
            scene.getStylesheets().add(Main.class.getResource("/css/style.css").toExternalForm());
            String home = System.getProperty("user.home");
            Path directory = Paths.get(home, "Documents", "duke");
            Path filePath = Paths.get(home, "Documents", "duke", "data.txt");
            duke = new Duke(directory, filePath);
            stage.setScene(scene);
            fxmlLoader.<MainWindow>getController().setDuke(duke);
            stage.show();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

list

😄

Download here

Copy link
Copy Markdown

@kerburenthusiasm kerburenthusiasm left a comment

Choose a reason for hiding this comment

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

Overall, I found your code easy to read and they follow the Java coding standard provided. However, some files such as Parser.java were difficult to read due to the nested if-else statements. Consider encapsulating some similar statements into a function to improve readability.

Comment thread src/main/java/duke/task/Task.java Outdated
return isMarked;
}

public boolean contains(String str) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Perhaps a change to the function name to sound more like a boolean?

Suggested change
public boolean contains(String str) {
public boolean hasString(String str) {

Comment thread src/main/java/duke/task/Todo.java Outdated

public class Todo extends Task {

public Todo(String description, boolean status) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Perhaps a change to the argument name to sound more like a boolean? I noticed this issue occurring in classes extending task.

Suggested change
public Todo(String description, boolean status) {
public Todo(String description, boolean isMarked) {

Comment thread src/main/java/duke/task/Event.java Outdated
Comment on lines +7 to +23
public class Event extends Task {

private LocalDate date;

public Event(String description, boolean status, LocalDate date) {
super(description, status);
this.date = date;
}

public Event(String description, LocalDate date) {
this(description, false, date);
}

public String toString() {
return String.format("[E][%s] %s (at: %s)", super.isMarked(), super.getDescription(), DateTimeFormatter.ofPattern("MMM d yyyy"));
}
} No newline at end of file
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Perhaps add header comments for the class and public functions. I noticed the same issue for classes extending Task and Command?

Copy link
Copy Markdown

@EvaderFati EvaderFati left a comment

Choose a reason for hiding this comment

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

Overall your code closely follows the coding standard and is nicely constructed. Only some small writing problems to fix.

this.task = task;
}

public void execute(TaskList tasks, Ui ui, Storage storage) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Although it is not required, it is recommended to add the '@ Override' annotation. https://stackoverflow.com/questions/1005898/should-i-add-an-override-annotation-when-implementing-abstract-methods-in-java

Comment thread src/main/java/duke/DukeException.java Outdated

public class DukeException extends Exception {

public DukeException(String message) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

According to the stupid Coding standard, should it be better to indent this line as 4 spaces instead of 2?

Copy link
Copy Markdown

@markbiju markbiju left a comment

Choose a reason for hiding this comment

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

Excellent attempt at following coding standard with absolutely minimal coding standard violations

Comment thread src/main/java/duke/task/Event.java Outdated

private LocalDate date;

public Event(String description, boolean status, LocalDate date) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Perhaps you could name status to be more boolean-sounding? :)

Comment thread src/main/java/duke/Parser.java Outdated
* @return UnmarkCommand instance.
*/
public Command parseUnmarkCommand(String fullCommand) {
String dataString = fullCommand.replaceFirst("unmark ", "");
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Commendable discretion shown here to differentiate when to use camelCase and when to use PascalCase.

Comment thread src/main/java/duke/Storage.java Outdated
assert data[1].equals("true") || data[1].equals("false") : throw DukeException("Invalid file input");
Boolean status = Boolean.parseBoolean(data[1]);
String text = data[2];
if (data[0].equals("T")) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The if-else class of statements should have the following form:
if (condition) {
statements;
} else if (condition) {
statements;
} else {
statements;
}

Comment thread src/main/java/duke/task/Deadline.java Outdated
}

public String toString() {
return String.format("[D][%s] %s (by: %s)", super.isMarked(), super.getDescription(), DateTimeFormatter.ofPattern("MMM d yyyy"));
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Perhaps this line is rather long and would benefit from a line break?

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.

4 participants