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

[Wang Haochen] iP #233

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

[Wang Haochen] iP #233

wants to merge 85 commits into from

Conversation

ssagit
Copy link

@ssagit ssagit commented Jan 28, 2021

Pull request for week 3 iP

/** Create validator for dates */
DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("d/MM/yyyy HHmm", Locale.ENGLISH);
DateValidator validator = new DateValidatorLocalDate(dateFormatter);
/** Handler for all UI stuff. */

Choose a reason for hiding this comment

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

I think adding an empty line between these logical blocks would help readability

@@ -0,0 +1,36 @@
package ssagit;

Choose a reason for hiding this comment

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

Seems a little odd that your package is called ssagit when the application is still called duke.

/**
* Checks if date given is valid, in the following order:
* date - time - locale;
* If all 3 fails, return with invalid, otherwise return results.

Choose a reason for hiding this comment

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

Maybe follow the javadoc style of comments? Use '@param' and '@return', etc.

public boolean isValid(String dateStr) {
LocalDateTime ldt = null;

try {

Choose a reason for hiding this comment

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

This is really hard to read, why do you need to catch the same kind of exception in so many different places? Maybe there's a way to have only one try-catch block?

/**
* Handler for all UI displays of Duke.java
*/
public class ConsoleUI {

Choose a reason for hiding this comment

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

I think UI should be Ui (lowercase i)

/**
* Exception class for missing todoTask descriptor.
*/
static class MissingTodoDescriptorException extends Exception {

Choose a reason for hiding this comment

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

I feel these exceptions should be under a different class, like a DukeException suggested in the project guide

* @param tasks List of tasks from file.
* @param taskIterator Integer to count number of tasks at a time.
*/
public void parseInput(Task[] tasks, int taskIterator) {

Choose a reason for hiding this comment

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

Whew this is long, maybe try moving some logic to other methods.

break;
case "todo":
case "event":
case "deadline":

Choose a reason for hiding this comment

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

This doesn't seem like good practice to me, should handle the todo and event in their respective cases I feel

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