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

[Kwong Chung Yue Jerry] Duke Increments #354

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

Conversation

jerryk1997
Copy link

No description provided.

* Prints the list of tasks which has descriptions
* matching that of a target String.
* @param taskList List of matching tasks
*/
public void showFoundTasks(LinkedList<Task> taskList) {
ListIterator<Task> iter = taskList.listIterator();
Task current;
Copy link

Choose a reason for hiding this comment

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

Your code looks pretty clean with the accurate variable naming as well as javadocs comments. Perhaps you could consider making packages to make it more organized? Otherwise it looks good

@FXML
public void initialize() {
scrollPane.vvalueProperty().bind(dialogContainer.heightProperty());
dialogContainer.getChildren().addAll(DialogBox.getUserDialog(Ui.showWelcome(), dukeImage));

Choose a reason for hiding this comment

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

I really like your idea of calling it in initialize, good job!

@@ -94,7 +95,7 @@ public void parseCommand(String input, TaskList taskList) throws DukeException {

taskList.addTask(newEvent);

ui.showTaskAdded(newEvent, taskList);
return ui.showTaskAdded(newEvent, taskList);
}

Choose a reason for hiding this comment

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

Good use of OOP and clean code! But reading through this it might be slightly unclear, maybe you can refactor this part to use case and switch statements?

Copy link

@etlow etlow left a comment

Choose a reason for hiding this comment

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

Methods and variables are well named and I appreciate the use of StringBuilders! Just have some comments about some parts.

public Event(String description, String eventDate, boolean status) {
super(description);
this.eventDateString = makeEventDate(eventDate);
this.eventDate = storeAsDateTime(eventDateString);
Copy link

Choose a reason for hiding this comment

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

Can be replaced with this(description, eventDate);

return builder.toString();
}

public static boolean correctInput(String input) {
Copy link

Choose a reason for hiding this comment

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

How about isCorrectInput

taskList.addTask(newEvent);

return ui.showTaskAdded(newEvent, taskList);
}
Copy link

Choose a reason for hiding this comment

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

Consider splitting into methods or classes. Maybe todo, deadline and event can go into another method parseTask, and the repeated lines can also be factored out?


sb.append(hour + ":" + minutes + ":00");

LocalDateTime dateTime = LocalDateTime.parse(sb.toString());
Copy link

Choose a reason for hiding this comment

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

How about

DateTimeFormatter formatter = DateTimeFormatter.ofPattern("d/M/yyyy HHmm");
LocalDateTime dateTime = LocalDateTime.parse(date, formatter);


return output;
}
}
Copy link

Choose a reason for hiding this comment

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

Good splitting of code into methods!

}
}

public boolean isExit() {
Copy link

Choose a reason for hiding this comment

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

could you include javaDoc here

return welcomeMessage;
}

public String showGoodbye() {
Copy link

Choose a reason for hiding this comment

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

Could you include javaDoc for this class

}
}

public String showTaskDone(Task task) {
Copy link

Choose a reason for hiding this comment

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

The two methods have the same body, maybe you could consider delete one.

* Filler method to imitate an interface.
* @return String empty string
*/
protected String toFileFormat() {
Copy link

Choose a reason for hiding this comment

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

could you abstract this class and method?

}
}

public String run(String input) {
Copy link

Choose a reason for hiding this comment

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

You can probably add JavaDocs here

Copy link

@CarbonGrid CarbonGrid left a comment

Choose a reason for hiding this comment

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

Good morning @jerryk1997 ,

I think that you have good OOP implementation; class responsibilities are clear and non-conflicting, e.g Ui not managing anything else other than I/O interaction. However, I believe you haven't used gradle checkstyle to verify your compliance to coding standard. In addition, I think you could try extracting repeated methods calls to reduce code duplication. You could also improve the parser by simplifying multiple if-case into a switch-case. This should also simplify input verification as non-expected inputs will generally enter into the default case.
There is also a Ui issue.
image

But all in all. It is good individual effort with taught methodologies.
Keep it up. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants