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

[Ng Song Guan] iP #46

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

[Ng Song Guan] iP #46

wants to merge 65 commits into from

Conversation

sgn00
Copy link

@sgn00 sgn00 commented Aug 21, 2020

No description provided.

Copy link

@ypinhsuan ypinhsuan left a comment

Choose a reason for hiding this comment

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

Looks good! Overall, I found your code clean and easy to read. There are only a few minor coding standard violations.

}

public static void main(String[] args) {
Duke duke = new Duke("./data/duke.txt");

Choose a reason for hiding this comment

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

Maybe it will be better to make the path ./data/duke.text a constant?

Comment on lines 44 to 65
case "bye":
return new ByeCommand();
case "list":
return new ListCommand();
case "todo":
case "deadline":
case "event":
if (splitString.length == 1) {
throw new InvalidDescriptionException();
}
return parseTask(command, splitString[1].trim());
case "done":
num = Integer.parseInt(splitString[1]);
return new DoneCommand(num);
case "delete":
num = Integer.parseInt(splitString[1]);
return new DeleteCommand(num);
case "find":
String matchString = splitString[1].trim();
return new FindCommand(matchString);
default:
throw new InvalidCommandException();

Choose a reason for hiding this comment

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

Maybe you can declare the strings as constants? For example private static final String BYE = "bye", and use case BYE:

* Starts execution of the Duke program.
*/
public void run() {
ui.printHello();

Choose a reason for hiding this comment

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

Why did you choose to use ui.printHello() instead of printHello() (the method right above) ?

import duke.task.Task;
import duke.util.TaskList;
import duke.util.Ui;

Choose a reason for hiding this comment

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

Might be better to add header comments here?

public String getResponse(String input) {
try {
Command c = Parser.parse(input);
String res = c.execute(tasks, ui);

Choose a reason for hiding this comment

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

Maybe you can give a better variable name? Such as response or result?

Copy link

@iqbxl iqbxl left a comment

Choose a reason for hiding this comment

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

Overall job job following the coding style!! Not much issues.


private Scanner scanner;

public Ui() {
Copy link

Choose a reason for hiding this comment

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

Perhaps you can add java docs for this method?


private List<Task> store;

public TaskList(List<Task> lst) {
Copy link

Choose a reason for hiding this comment

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

Maybe can add java docs for this method as well.

LocalDate date;
try {
switch (command) {
case "todo":
Copy link

Choose a reason for hiding this comment

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

Good job following the module's coding style of indentation for the switch case!

this.matchString = matchString;
}

public String execute(TaskList taskList, Ui ui) {
Copy link

Choose a reason for hiding this comment

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

Perhaps a bit lengthy code here? Not sure if some parts could be abstracted out of the execute method......

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.

None yet

3 participants