-
Notifications
You must be signed in to change notification settings - Fork 78
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
[Dexter Hoon] iP #68
base: master
Are you sure you want to change the base?
[Dexter Hoon] iP #68
Conversation
src/main/java/Alan.java
Outdated
//unmark tasks as undone | ||
String[] words = userInput.split(" "); | ||
|
||
tasks[Integer.parseInt(words[1])].setDone(false); |
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 you rename this line as a variable, seeing as you use it later in your code?
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.
Thanks for the suggestion... I think it could be helpful to do this as it can make my code neater :D
src/main/java/Alan.java
Outdated
|
||
System.out.println("Ok, I've marked this task as not done yet:"); | ||
System.out.println("\t[" + taskList[Integer.parseInt(words[1])].getStatusIcon() + "] " + | ||
taskList[Integer.parseInt(words[1])].getDescription()); | ||
System.out.println("\t[" + tasks[Integer.parseInt(words[1])].getStatusIcon() + "] " + |
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.
Maybe making some variables statement could make this less verbose
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 agree... will probably do that since it does look very complex and hard to understand what is going on
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.
The code quality is very high!
src/main/java/Alan.java
Outdated
System.out.println("\t[" + tasks[Integer.parseInt(words[1])].getStatusIcon() + "] " + | ||
tasks[Integer.parseInt(words[1])].getDescription()); |
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.
Try to avoid complicated expressions.
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.
Yeah very true... I will follow what someone else suggested by using more variables to simplify the statement
src/main/java/Alan.java
Outdated
System.out.println("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); | ||
} | ||
|
||
public static void main(String[] args) { |
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.
Try to avoid long methods. You can try to extract part of the code into other methods.
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.
Alright sure I can try to break the long method into smaller methods to handle each of the commands which can make it easier to debug and organise my code
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.
Good job on the PR! Here are some feedbacks:
Perhaps you would like to consider reviewing the variable names as I noticed that there was variable shadowing (i.e. currentTasksIndex is used as an attribute name as well as a parameter in the function).
Also, perhaps do you want to consider the standardisation of the use of variables and magic strings? I noticed that you declared variables for the error messages but not for the other messages and hence magic strings still exists.
Do you also want to consider using attributes for the tasks array and user input because it is the class' property and many methods will use them over and over again?
Finally, do you want to relook at the code readability as I noticed that many attributes and methods were not spaced consistently, making it difficult to read. Do you want to have a look at switch case or String.formatf
src/main/java/Alan.java
Outdated
public static void printTaskAddedMessage(Task[] tasks, int currentTasksIndex) { | ||
System.out.println("added: " + tasks[currentTasksIndex]); | ||
System.out.println("Now you have " + currentTasksIndex + " in the list."); | ||
} |
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.
Do you want to consider changing the variable name for the currentTasksIndex as I noticed that it shares the same name as the class attribute and might be ambiguous (have to be more careful in the future)?
src/main/java/Task.java
Outdated
this.description = description; | ||
} | ||
|
||
public boolean getDone() { |
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 would like to use a more boolean name for this method
1bc81a4
to
4194ba3
Compare
Add Date parsing for deadline and event tasks
# Conflicts: # src/main/java/alan/parser/Parser.java
# Conflicts: # src/main/java/alan/parser/Parser.java
Add find task functionality
# Conflicts: # src/main/java/alan/data/exception/AlanException.java # src/main/java/alan/parser/Parser.java # src/main/java/alan/storage/Storage.java # src/main/java/alan/ui/Ui.java
Add JavaDoc comments
No description provided.