-
Notifications
You must be signed in to change notification settings - Fork 462
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
[Moo Jun Wei] iP #504
base: master
Are you sure you want to change the base?
[Moo Jun Wei] iP #504
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than certain long methods and some small issues regarding coding standards, I think the code is fine. Keep up the good work! You are doing great :))
src/main/java/tasks/Deadline.java
Outdated
@Override | ||
public String toDataString() { | ||
return String.format("[D] | %d | %s | %s", | ||
isMarked() ? 1 : 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps you could look into replacing the 1 and 0 in the conditional statement with a named constant? It could be considered a "magic number".
src/main/java/Duke.java
Outdated
System.out.println( | ||
"Hello! I'm Duke\n" + | ||
"What can I do for you?" | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could perhaps break up the line before the operator, in accordance with the coding standards?
src/main/java/Duke.java
Outdated
loop(sc); | ||
} | ||
|
||
public void loop(Scanner sc) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method looks long and complex, could think of abstracting out key components into different methods?
src/main/java/Duke.java
Outdated
import java.io.IOException; | ||
import java.util.List; | ||
import java.util.Scanner; | ||
|
||
public class Duke { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be great if javadocs are included :))
Previously, the parse() method is lengthy. The body is divided into two main responsibilities - separating the input into the command keyword and the body, and then parsing them to return a Command. Code blocks are extracted into two private methods to improve the readability of the code and adhere to a single level\ of abstraction within parse().
Improve code quality in InputParser
Performing consecutive undos will undo commands one-by-one in order of the history of executed commands. Undo itself is not included in the history of executed commands.
Add ability to undo commands
switch (command) { | ||
case "bye": | ||
return new ExitCommand(ui); | ||
case "list": | ||
return new PrintTasksCommand(ui, tasks); | ||
case "mark": | ||
return new MarkTaskCommand(storage, ui, tasks, body); | ||
case "unmark": | ||
return new UnmarkTaskCommand(storage, ui, tasks, body); | ||
case "delete": | ||
return new DeleteTaskCommand(storage, ui, tasks, body); | ||
case "find": | ||
return new FindTaskCommand(tasks, ui, body); | ||
case "todo": | ||
return new AddTaskCommand(storage, ui, tasks, TaskType.TODO, body); | ||
case "deadline": | ||
return new AddTaskCommand(storage, ui, tasks, TaskType.DEADLINE, body); | ||
case "event": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this change(from if to swtich) is good!
Duke
Features
Downloads
Duke is FREE to download and use! (releases)
Quick Start
todo buy groceries
list
mark 1
Implementation
Here's the main method:
To be Completed