Skip to content

[Wang Haochen] iP#233

Open
ssagit wants to merge 85 commits into
nus-cs2103-AY2021S2:masterfrom
ssagit:master
Open

[Wang Haochen] iP#233
ssagit wants to merge 85 commits into
nus-cs2103-AY2021S2:masterfrom
ssagit:master

Conversation

@ssagit
Copy link
Copy Markdown

@ssagit ssagit commented Jan 28, 2021

Pull request for week 3 iP

Comment thread src/main/java/ssagit/Duke.java Outdated
/** Create validator for dates */
DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("d/MM/yyyy HHmm", Locale.ENGLISH);
DateValidator validator = new DateValidatorLocalDate(dateFormatter);
/** Handler for all UI stuff. */
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 adding an empty line between these logical blocks would help readability

Comment thread src/main/java/ssagit/Duke.java Outdated
@@ -0,0 +1,36 @@
package ssagit;
Copy link
Copy Markdown

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

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

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?

Comment thread src/main/java/ssagit/ui/ConsoleUI.java Outdated
/**
* Handler for all UI displays of Duke.java
*/
public class ConsoleUI {
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 UI should be Ui (lowercase i)

Comment thread src/main/java/ssagit/parser/Parser.java Outdated
/**
* Exception class for missing todoTask descriptor.
*/
static class MissingTodoDescriptorException extends Exception {
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 feel these exceptions should be under a different class, like a DukeException suggested in the project guide

Comment thread src/main/java/ssagit/parser/Parser.java Outdated
* @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) {
Copy link
Copy Markdown

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.

Comment thread src/main/java/ssagit/parser/Parser.java Outdated
break;
case "todo":
case "event":
case "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.

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