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

[Gernene Tan] iP #290

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

[Gernene Tan] iP #290

wants to merge 52 commits into from

Conversation

Gernene
Copy link

@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

@junrong98 junrong98 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.

return isMarked;
}

public boolean contains(String str) {

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


public class Todo extends Task {

public Todo(String description, boolean status) {

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

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

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

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


public class DukeException extends Exception {

public DukeException(String message) {

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

@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


private LocalDate date;

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

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? :)

* @return UnmarkCommand instance.
*/
public Command parseUnmarkCommand(String fullCommand) {
String dataString = fullCommand.replaceFirst("unmark ", "");
Copy link

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.

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

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

}

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

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