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

[Tyrus Lye]iP #557

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

[Tyrus Lye]iP #557

wants to merge 36 commits into from

Conversation

TyrusLye
Copy link

@TyrusLye TyrusLye commented Sep 4, 2023

No description provided.

Copy link

@remuslum remuslum left a comment

Choose a reason for hiding this comment

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

Good job, keep it up 💯

Copy link

@aarontxz aarontxz left a comment

Choose a reason for hiding this comment

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

Code seems logical and can handle tasks given, could package more chunks of codes into functions to make the code neater. Some quality of life changes for the user are commented too.

String command = scanner.nextLine();
System.out.println("____________________________________________________________");
try{
if (command.equalsIgnoreCase("bye")) {
Copy link

Choose a reason for hiding this comment

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

would it be better to use enumerates for the commands?

}
} catch (FileNotFoundException e) {
// Handle file not found exception
System.out.println("File not found: " + FILE_PATH);
Copy link

Choose a reason for hiding this comment

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

I like that the handling of this exception not only tells that user that the file cannot be found but also returns the filepath

for (int i = 0; i < tasks.size(); i++) {
System.out.println((i + 1) + ". " + tasks.get(i));
}
} else if (command.startsWith("todo")) {
Copy link

Choose a reason for hiding this comment

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

would it be better to package some of these if, else if else steps into a function that handles everything within the outer most if case? for eg. a function to handle creating todo here.

tasks.get(index).markDone();
System.out.println("Nice! I've marked this task as done:\n " + tasks.get(index));
} else {
System.out.println("Invalid task index.");
Copy link

Choose a reason for hiding this comment

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

would it be useful if instead of printing invalid task index, the size of the tasklist is also returned in this else case to let user know that for example there is only 3 tasks in the tasklist thats why their input 4 is invalid. Something like "Invalid task index, the task list has " + tasklist.size() + "tasks. "

Copy link

@nananakx-x nananakx-x left a comment

Choose a reason for hiding this comment

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

LGTM overall!! The naming of the methods are all of the course standard, just that it might be better for you to start adding javadoc to your public methods and also take note of the indentation of switch statements. Readability can also be improved if commands are split into different methods to handle each case (instead of putting all in one method). Good job so far! :D

if (command.equalsIgnoreCase("bye")) {
System.out.println("Bye. Hope to see you again soon!");
break;
} else if (command.equalsIgnoreCase("list")) {

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 if this part is separated into different functions like addToDoTask, etc. to improve readability, what do you think?

String description = parts[2];

Task task = null;
switch (type) {

Choose a reason for hiding this comment

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

For switch statements, I think there shouldn't be indentation on the next line. On the mod website:
switch (condition) {
case ABC:
statements;
// Fallthrough
case DEF:
statements;
break;
case XYZ:
statements;
break;
default:
statements;
break;
}

}

@Override
public String toString() {

Choose a reason for hiding this comment

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

Clean and concise, good job!

Scanner scanner = new Scanner(System.in);
ArrayList<Task> tasks = new ArrayList<>(100);
loadTasksFromFile(tasks);
String logo = "██╗░░░██╗██████╗░██████╗░░█████╗░██╗\n"

Choose a reason for hiding this comment

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

This is cool!!

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.

5 participants