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

[Keith Tan] iP #429

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

Conversation

nathtiekk
Copy link

No description provided.

damithc and others added 11 commits July 11, 2024 16:52
In build.gradle, the dependencies on distZip and/or distTar causes
the shadowJar task to generate a second JAR file for which the
mainClass.set("seedu.duke.Duke") does not take effect.
Hence, this additional JAR file cannot be run.
For this product, there is no need to generate a second JAR file
to begin with.

Let's remove this dependency from the build.gradle to prevent the
shadowJar task from generating the extra JAR file.
Copy link

@changjy81 changjy81 left a comment

Choose a reason for hiding this comment

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

put wrong review type; redone below

Copy link

@changjy81 changjy81 left a comment

Choose a reason for hiding this comment

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

Outside of some recurring coding standard violations, LGTM overall.

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

Choose a reason for hiding this comment

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

I see that the week 3 iP tasks were not pushed yet, but the classes should be in packages and should have header Javadoc comments on classes/methods

Comment on lines 9 to 14
"""
____________________________________________________________
Hello! I'm Kif
What can I do for you?
____________________________________________________________
""";

Choose a reason for hiding this comment

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

Huh, I wasn't aware of text blocks in Java. Good idea to use them!
Though I'm not sure of the code style requirements for their indentation...

introduce();
String userMessage = reader.readLine();
String[] splitMessage = userMessage.split(" ");
while(!isTerminate(splitMessage[0])) {

Choose a reason for hiding this comment

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

Shouldn't there be a whitespace after while here?
Noticed similar occurences in the rest of the code as well.

Comment on lines 48 to 67
switch (command) {
case LIST -> Task.listUserTask();
case MARK -> Task.markUserTask(Integer.parseInt(splitMessage[1]));
case UNMARK -> Task.unmarkUserTask(Integer.parseInt(splitMessage[1]));
case DEADLINE -> Task.Deadline.createDeadline(userMessage);
case EVENT -> Task.Event.createEvent(userMessage);
case DELETE -> Task.delete(Integer.parseInt(splitMessage[1]));
case TODO -> {
try {
Task.ToDo.createToDo(userMessage);
} catch (KifException e) {
System.out.println(e.getMessage());
}
}
default -> System.out.println(
"""
____________________________________________________________
OOPS!!! I'm sorry, but I don't know what that means :-(
____________________________________________________________"""
);

Choose a reason for hiding this comment

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

The case statements shouldn't be indented according to the coding standard?

Copy link

@gohlucas gohlucas left a comment

Choose a reason for hiding this comment

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

I can see the vision. Looking forward to Kif's development 👍

Comment on lines 9 to 14
private static final ArrayList<Task> userTasks = new ArrayList<>();
protected String description;
protected boolean isDone;
private static final String FILEPATH = "tasks.txt";
protected taskType type;
private static final String KEYWORD = "kifReservedKeyword";
Copy link

Choose a reason for hiding this comment

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

Would grouping variables by their access modifiers be better? For instance, grouping the private static final variables together etc...

}
}
} catch (FileNotFoundException e) {
//do nothing
Copy link

Choose a reason for hiding this comment

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

I would recommend handling the exception. This could be in the form of printing an error message to the user to inform them that there was an issue with the ongoing process

private static void editTaskTXT (int lineNumber, Kif.UserCommand operation) {
ArrayList<String> preItems = new ArrayList<>();
ArrayList<String> postItems = new ArrayList<>();
ArrayList<String> editLine = new ArrayList<>();
Copy link

Choose a reason for hiding this comment

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

Would changing the variable name to a plural form be more inline with the Java Coding Standard for collection of objects?

}

public static void listUserTask() {
System.out.println("____________________________________________________________");
Copy link

Choose a reason for hiding this comment

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

Would extracting the line into a static final variable provide a cleaner body for the methods? I noticed this line is used quite extensively in this file

public static void markUserTask(int key) {
Task currentTask = userTasks.get(key - 1);
currentTask.isDone = true;
editTaskTXT(key, Kif.UserCommand.MARK);
Copy link

Choose a reason for hiding this comment

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

Suggested change
editTaskTXT(key, Kif.UserCommand.MARK);
editTaskTxt(key, Kif.UserCommand.MARK);

Copy link

Choose a reason for hiding this comment

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

Perhaps this would be more in line with the java coding standard

Comment on lines 24 to 32
public enum UserCommand {
LIST,
MARK,
UNMARK,
DEADLINE,
EVENT,
TODO,
DELETE;
}
Copy link

Choose a reason for hiding this comment

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

I love that you created an enum for the types of commands!!

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